-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Ahh your using post and have already grabbed the ID so try header("Location: OrganiseIDASX.php?id=$id");
-
Splitting up a string (response) into separate variables
MadTechie replied to jwhite68's topic in PHP Coding Help
without delimitors your need to pad them to the exact length then use something like substr, just an idea 1 question, why are you doing it this way? -
[SOLVED] passing variables/values out of while block
MadTechie replied to everisk's topic in PHP Coding Help
cool your welcome -
erm.. try this (created on the fly, may have errors) <?php if ($status == 1) { //Added following for crediting Logic if($ip == "75.126.157.90" or "204.10.140.62" or "204.10.140.63") $sql="select oWeight from offers where oCampID='" . $campaign . "'"; else $sql="select oWeight from offers where oName='" . $name . "'"; $result = mysql_query($sql); $oWeight=0.0; if($r=mysql_fetch_array($result)) { $oWeight = (float)$r['oWeight']; } //Updating ostatus with weightage rather then 1 or 0. $totalO=0; $result =mysql_query("SELECT `ostatus` FROM `users` WHERE `uid`='$sid'"); $currOStatus = 0.0; if($r=mysql_fetch_array($result)) { $currOStatus= (float)$r['ostatus']; } if(($currOStatus+$oWeight)>1) $totalO=100; else $totalO=$currOStatus+$oWeight; ?>
-
Well done also said its 90% done but
-
just a quick one (on the phone so kinda hard to do) <p><font color="#999999"><span style="font-size: 15pt">Question Asked<br> </span></font><font size="2"> <?php $question = addslashes($_POST['question']); echo $question; ?> </font></p> <p><font color="#999999"><span style="font-size: 15pt">Answer<br> </span></font><font size="2"> <?php $host = 'localhost'; $user = '?'; $pass = '?'; $db = '?'; $connect = mysql_pconnect($host, $user, $pass); $selectdb = mysql_select_db($db); mysql_connect($host, $user, $pass); mysql_select_db($db); $SQLq = "SELECT * FROM `search` WHERE "; $parts= explode(" ", $question); $start = "`question` LIKE '%"; $middle = "%' AND `question` LIKE '%"; $end = "%'"; $search = $start.implode($middle, $parts).$end; echo $SQLq.$search; $SQLq = $SQLq.$search; //$SQLq = "SELECT * FROM `search` WHERE `question` LIKE '$question'"; $sql = mysql_query($SQLq)or die(mysql_error()); $fetch = mysql_fetch_array($sql); $answer = $fetch['answer']; if($answer == ""){ echo 'Sorry, I dont know the answer to that one.'; } else { echo $answer; } ?> </font></p>
-
try <?php header("Location: OrganiseIDASX.php?id={$_GET[$id]}"); ?> if this fails what error, also we really need to see more code
-
see last post basically have 90% done
-
No.. "SELECT * FROM `search` WHERE `question` = 'what' will only find record(s) which ONLY have 'what' in the question field if you do "SELECT * FROM `search` WHERE `question` LIKE '%what%' it will find all that have 'what' anywhere in the field question.. heres the code i would use <?php $search = "what is vb"; $SQLq = "SELECT * FROM `search` WHERE "; $parts= explode(" ", $search); $start = "`question` LIKE '%"; $middle = "%' AND `question` LIKE '%"; $end = "%'"; $search = $start.implode($middle, $parts).$end; echo $SQLq.$search; $SQLq = $SQLq.$search; ?> NOTE it needs cleaning up (ie search on 0/1 word) will fail
-
hint: start = "`question` LIKE '%" middle = "%' AND `question` LIKE '%" end = "%'"
-
if you look at my last post, a few tweak and you should beable to get it working.. basically you final SQL query should be something like this $SQLq = "SELECT * FROM `search` WHERE `question` LIKE '%what%' AND `question` LIKE '%is%' AND `question` LIKE '%vb%' "; so you need to alter the basic script i wrote from what OR is OR vb to `question` LIKE '%what%' AND `question` LIKE '%is%' AND `question` LIKE '%vb%'
-
maybe use explode & implode $search = "what is vb"; $parts = implode(" ", $search); $search= explode(" or ", $parts); echo $search; your need to clean this up but its a start
-
in the first chunk of code.. your not setting $folder_id etc.. infact i can't see a single time you fetch the data!
-
Last one looks nice, but i feel that its a little empty in the white space around the "dummy text of printing and", but i am usless as a designer
-
try moving mysql_close(); to the end (when you finished with it)
-
try <p><font color="#999999"><span style="font-size: 15pt">Question Asked<br> </span></font><font size="2"> <?php $question = addslashes($_POST['question']); //<-Changed echo $question; ?> </font></p> <p><font color="#999999"><span style="font-size: 15pt">Answer<br> </span></font><font size="2"> <?php $host = 'localhost'; $user = '?'; $pass = '?'; $db = '?'; $connect = mysql_pconnect($host, $user, $pass); $selectdb = mysql_select_db($db); mysql_connect($host, $user, $pass); $SQLq = "SELECT * FROM `search` WHERE `question` LIKE '%$question%'"; echo $SQLq; $sql = mysql_query($SQLq)or die(mysql_error()); $fetch = mysql_fetch_array($sql); $answer = $fetch['answer']; echo $answer; ?> </font></p> any errors ? EDIT: updated the SQLq
-
thats nice, thanks for letting us know that
-
note you can remove the ."($red)" as they are just for debugging
-
[SOLVED] oho hit counter unique using mysql
MadTechie replied to marksie1988's topic in PHP Coding Help
you need to store the IP's i would also recommend MySQL, look here Simple MySQL PHP Hit Counter -
try this <?php $red = ($red); switch($red) { case '0': echo '<img src="./one.gif"> - red zero'."($red)"; break; case '1': echo '<img src="./four.gif"> - red one'."($red)"; break; case '2': echo '<img src="./three.gif"> - red zero'."($red)"; break; } ?>