redking
Members-
Posts
21 -
Joined
-
Last visited
Never
Everything posted by redking
-
no, don't use a cron use the time thing find out how much time has passed and update accordingly. You could create a function that, anythime gold is accessed it would be updated.
-
Yeah, I would serialize an array and store it in the database. then when you unserialize it use $array[] to add new ones.
-
$query = "SELECT * FROM ads WHERE category = 'Drivers' AND validation = 0 ORDER BY '$price' $limit"; should be $query = "SELECT * FROM ads WHERE category = 'Drivers' AND validation = 0 ORDER BY price DESC $limit"; where price is the name of your price field in the database DESC = descending order ASC = Ascending order
-
Could you post your code?
-
I only know about zend, but the zend PHP 5 debugger can't do database code, which makes it really annoying
-
could you try running this and tell me if it runs correctly? (just give a known value to the variables) <?php $_POST['User_Name'] = "foo"; $Login['User_ID'] = 123; $Login['Login_ID'] = 123; $User_Name = $_POST['User_Name']; $User_ID = $Login['User_ID']; $Login_ID = $Login['Login_ID']; setcookie("User_Name", $User_Name, strtotime('+ 30 minutes')); setcookie("Login_ID", $Login_ID, strtotime('+ 30 minutes')); setcookie("User_ID", $User_ID, strtotime('+ 30 minutes')); ?>
-
I think the problem is that the $user object is a global variable and cannot be accessed from within the function. try either function doCommision() { global $user; if ($user->jv == 'y') { define( "AFFILIATE_COMMISSION", 20 ); } else { define( "AFFILIATE_COMMISSION", 10 ); } } or function doCommision($user) { if ($user->jv == 'y') { define( "AFFILIATE_COMMISSION", 20 ); } else { define( "AFFILIATE_COMMISSION", 10 ); } }
-
[SOLVED] how to timeout $_SESSION after 5 minutes of idle time
redking replied to clown[NOR]'s topic in PHP Coding Help
session_cache_expire(5); put this before session_start(); -
$booked should probably be an array like this $booked[$month] = array($booked_day1 , $booked_day2 , $booked_day3 ); if (in_array($day , $booked[$month])) //do highlighting and outputting here
-
You probably included the same file more than once by accident, use include_once or require_once wherever you included the function.php file. or make sure it is only included once, it may be inside of a loop or somthing.
-
Why is my db not collecting all of the info?
redking replied to ballhogjoni's topic in PHP Coding Help
Did you try echoing $_POST['STREET1']? if so, did it have the correct value? -
$result = $client->call('ConvertTemperature', $param); echo "The message is: " . $result['ConvertTemperatureResult'];
-
Why is my db not collecting all of the info?
redking replied to ballhogjoni's topic in PHP Coding Help
is the STREET1 column in the database set to varchar? -
I disagree with patrick, querying 10,000 rows and adding them seems to be a lot of unnecessary processing, especially if you plan on having alot of users. I would go with option number 2 and only query the 10,000 row table to check if people have voted before.
-
What that means is that you are defining the function tab() twice. this file has the function tab() C:\Program Files\xampp\htdocs\functions.php so does this one C:\Program Files\xampp\htdocs\parser\functions.php delete the function in one or the other or don't include one of the files
-
basically what he said, except it should be a cron job, that way it will be forked and won't consume all of your processor speed. and to listen for a port you are going to need to use the php socket functions, I suppose you know somthing about sockets and the like... http://www.php.net/manual/en/ref.sockets.php heres some reference for php sockets I'm not sure exactly what you are trying to do, so I really cant give you any example source. loop forever 1 . have it listen for an incoming connection 2 . If you get an incoming connection create your connection to the servlet and send whatever you need to send. I hope my incoherent ramblings help
-
What are you trying to do with that $query? Is is supposed to get data from the database or put data into it?
-
[SOLVED] .PHP form works on site with 4.4.4 but not with 5.0.5
redking replied to shaunmacie's topic in PHP Coding Help
Sorry it took me so long the problem is that you have register globals turned on in php 4 and its off in php 5. Register globals is BAD and should be turned off. The problem is that you have $validationOK=true; if (Trim($visitor)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.campuscalm.com/error.html\">"; exit; } it should be $validationOK=true; $visitor = $_POST['visitor']; //<---- here is the change if (Trim($visitor)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.campuscalm.com/error.html\">"; exit; } I hope this works -
I'm guessing you have an sql query. somthing like $sql = "SELECT * FROM `bar` WHERE `foo` = '1'"; change that to $sql = "SELECT * FROM `bar` WHERE `foo` = '1'" ORDER BY `column` ASC"; ASC goes from 1 to 10 A to Z DESC goes from 10 to 1 Z to A hope this helps
-
[SOLVED] .PHP form works on site with 4.4.4 but not with 5.0.5
redking replied to shaunmacie's topic in PHP Coding Help
I could help you out if you would post the errors that the php 5 gave you. -
I see what you are trying to do, and it won't work. There are two ways of doing what you are trying to do. the first would be to replace your print line with this: eval('$value = $p' . $searchvar . '0[\'id\'];'); print $value; or a cleaner, cooler, and all around better method would be to use an array like so: $sql = mysql_query("SELECT * FROM own WHERE ID='$P1'"); $P[0] = mysql_fetch_assoc($sql); $sql = mysql_query("SELECT * FROM own WHERE ID='$P2'"); $P[2] = mysql_fetch_assoc($sql); if ($x>$y) $searchvar = 0; else $searchvar = 1; print $p[$searchvar]['id']; or the best, fastest and cleanest way of all: if ($x>$y) $sql = "SELECT * FROM own WHERE ID='$P1'"; else $sql = "SELECT * FROM own WHERE ID='$P2'"; $result = mysql_query($sql); $p = mysql_fetch_assoc($result); print $p['id']; you should probably use the bottom one, unless you have a compelling reason not to.