-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
I don't know what you mean by bulk ! if you mean many different queries at once then MySQLI could do it, Looking back on your code the one thing i would suggest is you echo the query on the success, as i believe your WHERE email='{$_SESSION['email']}' would become WHERE email='' as i seen no session_start(); in your script
-
Displaying image with PHP in Sequence.
MadTechie replied to iconicCreator's topic in PHP Coding Help
You could use cookies, heres a basic example (i tried to keep it simple) i hope you get the idea replace $i = rand(0, count($images)-1); with if(!empty($_COOKIE['ad_image'])) { $_COOKIE['ad_image']++; if($_COOKIE['ad_image'] > count($images)) $_COOKIE['ad_image']=0; }else{ $_COOKIE['ad_image'] = 0; } $i = $_COOKIE['ad_image']; -
[SOLVED] Modify Query to Show Five Most Recent Products
MadTechie replied to webref.eu's topic in MySQL Help
add limit to 5 $sql = "SELECT * FROM Products ORDER BY ProductDateAdded DESC LIMIT 0,5"; -
replace die ("error editing information"); with die (mysql_error()); and define what you mean by
-
It depends on all of the conditions but you could probably use a RegEx, I think you mean you have 3 blocks which you need to replace a value BUT ONLY know the value of the first one. i guess you could try something like this <?php $HTML = "<tr><td nowrap=\"1\" width=\"33%\"> QWE1 </td> <td nowrap=\"1\" width=\"33%\"> KSJDWS </td> <td nowrap=\"1\" width=\"33%\"> SDKSJWN </td> </tr>"; $find = 'QWE1'; $replace = 'ABC'; $HTML = preg_replace('/(<[^<]*?)'.$find.'(.*?\1)[^<]*(.*?\1)[^<]*(<)/sim', '\1'.$replace.'\2'.$replace.'\3'.$replace.'\4', $HTML); echo $HTML; ?>
-
No that won't work, your need to send the Header data, use cURL's CURLOPT_USERAGENT curl_setopt($curl, CURLOPT_USERAGENT, '<script>alert(\'PHP Freaks Rule\')</script>'); If you are using any of the header info then you need to filter it first, if not then don't worry
-
Can someone tell me what this code is for? <?PHP } ?>
MadTechie replied to bgbs's topic in PHP Coding Help
they are just too lazy to do this instead <?php include('inc.submembers.php'); echo "</td></tr>"; } ?> -
[SOLVED] Autofill a form element by clicking on a link?
MadTechie replied to madhattan's topic in PHP Coding Help
update the form then ie <input type="text" name="Name" value="<?php echo "whatever"; ?>" /> -
What part don't use understand ? Lets just say you have a Javascript or PHP use grabs the User-Agent and echo's that to the page Now the problem is, User-Agent comes from the browser BUT it should NOT be trusted, as it can be changed to anything, for example, echo $_SERVER['HTTP_USER_AGENT']; may output Nothing wrong with that.. BUT if I changed my User-Agent to <script>alert('PHP Freaks Rule');</script> I'll get an alert, this is the basis behind injections, its only a problem when coders don't filter the untrusted data, and some coders think that $_SERVER['anything'] is safe! and they find out the hard way.
-
[SOLVED] Autofill a form element by clicking on a link?
MadTechie replied to madhattan's topic in PHP Coding Help
And the problem is ? -
theirs a few ways, here's a simple one $x = pathinfo('abcde.jpg'); echo $x['filename']; //echo $x['extension']; //if you wanted the jpg
-
Just use Limit select * from `blueprint_items` where `id`=? LIMIT 0,1 Again LIMIT 0,1 Moving to correct section (being an SQL problem)
-
[SOLVED] Database returning all variables if when it cant fine WHERE
MadTechie replied to krio's topic in PHP Coding Help
if you searched WHERE usernames LIKE '%madtechie%' OR subjects LIKE '%' it finds every subject as subjects LIKE '%' means any subject so the username part is kinda pointless I'll also like to point out you shouldn't have the @ on the query as it omit errors (which during development you want to see) if you update to $resultsearch = mysql_query ( $querysearch ) or die($querysearch.mysql_error()); your get a better error report for debugging -
[SOLVED] Database returning all variables if when it cant fine WHERE
MadTechie replied to krio's topic in PHP Coding Help
Well the function does echo's data! the reason your getting all the records is because if $serialsearcher is empty then you are querying the following:~ serialnumber LIKE '%' which means any! add $serialsearcher to the function parameters and try something like this (rough draft) $q =""; if(!empty($serialsearcher)) $q .= "serialnumber LIKE '%$serialsearcher'"; if(!empty($search)) { if(!empty($q)) $q .= " OR "; $q .= "name LIKE '%$search%'"; } $querysearch = ("SELECT * FROM parts WHERE $q "); -
header info should be valid, What doesn't work?
-
Is this solved? If so please click topic solved bottom left
-
remove the $notice_text from your code and add the text directly into the plain text $plain_text = "$first_name,\n\n" . "IF YOU CANNOT READ THIS EMAIL FOLLOW THIS LINK: www.mysite.com/repairstatus.html\n". "Thank you for stopping by Luggage Shop. This emails contains information about your recent repair\n\n" .
-
[SOLVED] Strange MySQL Error that wasnt there before.
MadTechie replied to Woodsyx's topic in PHP Coding Help
add or die(mysql_error()); $value = mysql_query("SELECT name FROM idlers WHERE name='".mysql_real_escape_string($name)."' LIMIT 1") or die(mysql_error()); -
Need help with Script? Thank you for your help!
MadTechie replied to bchandel's topic in PHP Coding Help
Your need to post more complete code, -
[SOLVED] how can i avoid long words on string??
MadTechie replied to yami007's topic in PHP Coding Help
of course but i would only use it for output, $para = $_POST['elementName']; in truth i would use CSS -
[SOLVED] Column 'ID' in where clause is ambiguous
MadTechie replied to Gayner's topic in PHP Coding Help
Sorry it was 7am and i had no sleep, i assume the problem was t.name = cl.id -
[SOLVED] Column 'ID' in where clause is ambiguous
MadTechie replied to Gayner's topic in PHP Coding Help
The get has nothing to do with the field names if your passing ID via get then i would guess that your code would look like this $id = $ibforums->input['ID']; //updated $DB->query("SELECT cl.*, t.desktop AS to_desktop from ibf_faq AS cl INNER JOIN ibf_members AS t ON t.name = cl.id WHERE cl.id='$id'"); //updated -
[SOLVED] Column 'ID' in where clause is ambiguous
MadTechie replied to Gayner's topic in PHP Coding Help
(I just noticed the as cl) try WHERE cl.id='$id' -
[SOLVED] Column 'ID' in where clause is ambiguous
MadTechie replied to Gayner's topic in PHP Coding Help
Okay put it this way ibf_faq has a field called ID ibf_members has a field called ID and your saying WHERE ID='$id' What ID are you trying to use ? the ID from ibf_faq or ibf_members? I'll guess and say ibf_faq, so change WHERE ID='$id' to WHERE ibf_faq.ID='$id' -
try this *untested* $data = " the quick red fox jumped over the lazy dog "; $data = trim(preg_replace('/(\s)(\1+)/im', '\1', $data)); echo $data;