Hey
i am having a table with 8 column and following values
1 2 3 4 5 6 7 8
0 1 0 0 0 0 0 0
i need a query which will analyze the no of 1's and 0s in the column and if no of 0 is greater than 4 then it should print failed else pass,how can i do that? either by MYSQL or PHP?
...
Bit of a puzzle for you guys. I can come up with blunt workaround (below) but I thought it would present it to you all to see if there was a more elegant solution out there. Keep in mind I'm looking for a PHP or MySql only solution.
Tables is 'candles2'. I have a MySQL TEXT column 'time' that has a datestamp in it ( e.g. 2010.08.13 19:3...
I am trying to copy all the files from a directory to another directory in php.
$copy_all_files_from = "layouts/";
$copy_to = "Website3/";
Can someone help me do this please.
...
This is some sample text from a large text file.
(2, 1, 3, 2, 'text...','other text...', 'more text...', ... ),
(3, 1, 3, 2, 'text...','other text...', 'more text...', ... ),
(4, 1, 3, 2, 'text...','other text...', 'more text...', ... ),
(5, 1, 3, 2, 'text...','other text...', 'more text...', ... ),
(6, 1, 3, 2, 'text...','other text.....
Hi,
I am getting the error (mysql_fetch_row(): supplied argument is not a valid MySQL result resource in) for this query. Why?
<?php
set_time_limit(0);
//MySQL globals
$mysql_server = "***";//change this server for your Drupal installations
$mysql_user = "***";//Ideally, should be root
$mysql_pass = "***";//Corresponding password
$con...
I am trying to use simple_html_dom to extract some data from a website. Unfortunately somehow in the middle of the data to be analyzed it cuts off a part which means the data that I want to extract is or is not part of the string that I can analyze.
This is my code:
<?php
include_once('../../simple_html_dom.php');
function mouser(...
After setting up a mysqli object in php, i want to make to insert some POST variables into a table, but I have a question about how the quotes will work out:
$sql = "INSERT INTO whatever (a, b, c)
VALUES ('$_POST[a]','$_POST[b]','$_POST[c]')";
I'm aware, however, that most times I've used global variables like POST or GET, there are ...
I recently had this code created for my Wordpress site. It makes it so that unregistered users can not see the newest posts available up to 15 days unless they register. It works, but I need it to only restrict one specific category in my Wordpress installation and not all of them (i.e. I need it to restrict this category but not my bl...
Thanks in advance for any help. :)
Ok, here's my problem.
Simplified version of the code:
global space with include file
include file where $var is defined and function is called that returns an include statement
include file returned by function and where $var is no longer accessible
Why is $var no longer accessible?
I susp...
hi,
why does this query work? how am i supposed to write it?
select * from tbl_content order by year desc where visible = '1' limit 0,30;
...
I am creating a table (stats_1) dynamically and would like to have each row of different background color. So far, all the lines have the same background color.
I have the following php code that prints echoes out and statements:
$keys = array('Col1', 'Col2','Col3','Col4','Col5','Col6','Col7');
echo '<table id="stats_1"><tr>'; ...
Hi,
I'm a PHP newbie. I'm trying to use preg_match_all function in the below program to find all subjects with their marks, but I'm getting only one match. I have been struggling with this for 5 hours. Can someone help me in figuring out whats wrong? Thanks in advance.
<?php
$semArray="<B>STUDENTS NAME (7ab05cs001) </B><br><br><br><br>...
I need to set, automatic session time out after some fixed time in my site.
I used the script below but it's not working properly.
I set the some time but it automatically times out before that time.
if((empty($Session_UserId)) || (empty($Session_Username)))
header("Location:index.php");
if($_SESSION['session_count'] == 0) {
$_SE...
i have 2 tables
1st table called services has id_service, name, date. description
2nd table called services_images has id_img, img_name,id_service
Let's say now that I have to, with one query (if possible), return 2 arrays
1st array with fields from one specific id from table "services"
2nd array with fields from all the images relat...
I'm trying to synchronize the timezone between a PHP script and some JavaScript code.
I want a PHP function that returns a timestamp in UTC. Does gmmktime() do that?
On the JavaScript side, I have:
var real_date = new Date();
real_date -= real_date.getTimezoneOffset() * 60000;
real_date /= 1000;
Does this convert the timestamp...
I have a script at www.mydomain.com/mydirectory/index.php. I want to map all requests to subdirectories of mydirectories to the script. For instance, www.mydomain.com/mydirectory/mypath/ should be rewritten to www.mydomain.com/mydirectory/index.php/mypath/
How can I accomplish this? Thanks.
...
The url would be something like this:
www.example.com/index.php?file=myFile.ext
The filtering would only allow leters and numbers in the file, and only one dot.
The filtering would not give characters from the input to the file functions, instead, on for every allowed character it matches in an internal array, it copies the character...
Hey
I want to store the contents of an xml file in the database. Is there an easy way to do it?
Can i write some script that can do the task for me?
The schema of the XML file looks like this:
<schedule start="20100727120000 +0530" stop="20100727160000 +0530" ch_id="0210.CHNAME.in">
<title>Title_info</title>
<date>20100727</d...
//display faction userlevel:
$level_boss = $req_faction_info['f_boss'];
$level_uboss = $req_faction_info['f_uboss'];
$level_rhm = $req_faction_info['f_rhm'];
$level_lhm = $req_faction_info['f_lhm'];
$level_r1 = $req_faction_info['f_r1'];
$level_r2 = $req_faction_info['f_r2'];
if($level_boss == $username){ $u_level = 'Boss'; }
elsei...
Hi all!
I am working on a turn based web game in PHP5.
This is pretty simple game, a kind of board game: two people join a "session" and they play until one of them wins.
My problem in nutshell:
User A and User B play a game.
User A finished his turn
Request will be sent to the server to perform necessary operations.
Now it is time ...