Jump to content

golyath

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

golyath's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi i have written a simple searching script so that it builds a Sql statement and passes it back to another page for the results. It simply works with a check box if you want to see all items, and a drop down box if you want to serch with certain criterea and then a text box to enter the thing you are searching for... e.g. drop down = Firstname textbox = Edward. Searching for all records where firstname = Edward. this is the script:     php:     <?         $crit=$_POST['crit'];         $search=$_POST['search'];                 if($all == "all"){             $sql="SELECT * FROM users";             header("location:index.php?section=cPanel&control=members&ctrlMem=view&sqlCheck=$sql");         }         else{             if($search == ""){                 header("location:index.php?section=error&error=missing");             }             else{                 $sql="SELECT * FROM users WHERE $crit = '$search'";                 //echo $sql;                 header("location:index.php?section=cPanel&control=members&ctrlMem=view&sqlCheck=$sql");             }         }     ?> this works fine if all is selected, and the Sql statement is sent back and works fine... But... If you try to use the section where you are searching for a certian criteria, the sql errors out when usign it on the next page saying:     php:Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource     ?> I have echoed out the sql when testing it to see if the sql statement is wrong, but i cant see anythign wrong with it: SELECT * FROM users WHERE firstname = 'Edward' If anyone can point me in the right direct it would be greatly appreciated. Thanks
  2. Cheers, I ahve tried both and they both stop the error coming up... but it returns "wrong" but it should return correct. Have structured the statement correctly? thanks
  3. All i want to do is check the $data variable is in the correct format (i.e 99-aa-00 9999:99) I have tried to get these to work for me but none seem to. I have put the regex through a regex checker and it works... i have this: [tt]<?php $data = "99-aa-00 9999:99"; $result=preg_match("/^[0-9]{2}-[a-Z]{2}-[0-9]{3}\s[0-9]{4}:[0-9]{2}$/", $data); if($result != "0"){ echo "correct"; } else{ echo "wrong"; } ?>[/tt] but it always returns this error: Warning: preg_match() [function.preg-match]: Compilation failed: range out of order in character class at offset 13 can anyone tell me what im doing wrong. thank you for any help, its muchley appreciated
  4. HI there, I have a dreamweaver php template with a table that consists of a banner at the top a horizontal menu bar an editable region bellow and a footer. This all works fine, but if i have a doc bassed on the template and if (and only if) i pass in an argument through the url (newsItem.php/?id=1) then the banner does not show... i have been staring at the code for ages and ant find why this is. im not sure why it would work fine if you dont pass an argument... has anyone seen anything like this before? cheers for any help, muchly appreciated. golyath oh here is the code if you wanna see: [tt]<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/PHP_template.dwt" codeOutsideHTMLIsLocked="false" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title>Untitled Document</title> <!-- InstanceEndEditable --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> </head> <body text="#000000" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF"> <div align="center"></div> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">   <tr>     <td><div align="center"><img src="images/Banner.jpg" width="800" height="150" /></div></td>   </tr>   <tr>     <td bgcolor="#095E00"><font color="#FFFFFF" size="-2" face="Verdana, Arial, Helvetica, sans-serif">|       HOME | THE COMMITEE | SOCIAL EVENTS | SKI + BOARD TEAM | THE HOLIDAY | MERCHANDISE       | MEDIA | LOG IN |</font></td>   </tr>   <tr>     <td bgcolor="#FFFFFF"><!-- InstanceBeginEditable name="EditRegion3" -->       <? $username="astonsk"; $password="733edbb"; $database="astonsk_sur1"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die("Unable to select database"); $query="SELECT * FROM posts WHERE postID = $_GET[id]"; $result=mysql_query($query); $title=mysql_result($result,$i,"title"); $date=mysql_result($result,$i,"date"); $content=mysql_result($result,$i,"content");   ?>   <table width="800" border="0" cellspacing="0" cellpadding="0">         <tr>           <td><strong><font color="#000000" size="5" face="Verdana, Arial, Helvetica, sans-serif"><? echo $title ?></font></strong></td>           <td><div align="right"><font size="3" face="Verdana, Arial, Helvetica, sans-serif"><? echo $date ?></font></div></td>         </tr>         <tr>           <td colspan="2"><font color="#000000" size="-2" face="Verdana, Arial, Helvetica, sans-serif"><? echo $content ?></font></td>         </tr>       </table> <!-- InstanceEndEditable --></td>   </tr>   <tr>     <td bgcolor="#095E00"><div align="center"><font color="#FFFFFF" size="-2" face="Verdana, Arial, Helvetica, sans-serif">&copy;         Aston Snow 2006/2007</font></div></td>   </tr> </table> </body> <!-- InstanceEnd --></html> [/tt]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.