garyneedham7202
Members-
Posts
9 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
garyneedham7202's Achievements
Newbie (1/5)
1
Reputation
-
Hi Can anyone help? I want to store some text in a text field but the text contains an ' Apostrophe for example i want to store the following text zegrep -ha ' (RCV|SND).*ML3407.*(GRSG)' but it will not save with these Apostrophes if I remove them it will save Can I use a different type of field that will except these Apostrophes
-
Whats the best structure for a Sql search?
garyneedham7202 replied to garyneedham7202's topic in MySQL Help
Hi Psycho I have managed to find the small mistake Jessica hinted at and all is fine now I apologise to those people who think I'm wasting there time. Again thank you psycho for you patience and time -
Whats the best structure for a Sql search?
garyneedham7202 replied to garyneedham7202's topic in MySQL Help
Hi Psycho Thanks very much for the example above its just what I need as a reference. I have run the Query and I'm getting this back Do you have any idea what is going wrong. I've run the same query on the old one and I do get a result back Cheers There was an error running the query Query: SELECT id, PLC, DateOpened, Raised_by, Block, Description FROM log WHERE PLC LIKE '%AI02A%' ORDER BY DateOpened DESC Error: Query was empty -
Whats the best structure for a Sql search?
garyneedham7202 replied to garyneedham7202's topic in MySQL Help
Sorry but I think you are confusing don't listen to not understanding i really don't know why you bother replying to people if you cannot be polite and helpful who do you think you are!! I think you need to climb down from that silver tower you have put yourself on. -
Hi I have the following layout which works fine, but I would like to know if its the best structure and is there a easier more structured way to achieve the same thing. <?php include("includes/db.config.php"); ?> <?php $sql = "SELECT * FROM log WHERE PLC LIKE '%" . mysql_escape_string($_GET['PLC']) . "%' ORDER BY DateOpened DESC "; if (empty($_GET['PLC'])) $sql = "SELECT * FROM PLC WHERE 1 = 2 "; $res = mysql_query($sql); ?> <form> <span class="ContentStyle">Please enter PLC name </span><span class="style4"> </span> <input type="text" name="PLC" size="20" maxlength="20" value="<?=$_GET['PLC']?>" > <input name="submit" type="submit" value="Search"> <span></span> </form> <table width="692"> <tr> <?php while ($r = mysql_fetch_assoc($res)) { ?> <td width="133"><a href="ocado_edit_my_log.php?id=<?=$r['id']?>">Edit</a></td> <td width="543"><a href="singlelog.php?id=<?=$r['id']?>"><?=$r['PLC']?></a></td> </tr> <tr> <td>Date raised</td> <td><?=$r['DateOpened']?></td> </tr> <tr> <td>raised by</td> <td><?=$r['Raised_by']?></td> </tr> <tr> <td>Block</td> <td><?=$r['Block']?></td> </tr> <tr> <td>Description</td> <td><?=$r['Description']?></td> </tr> <?php } ?> </table>
-
Thanks for the feedback I'm getting this result Server error The website encountered an error while retrieving http://www./search_between_dates.php. It may be down for maintenance or configured incorrectly. Here are some suggestions: Reload this webpage later. HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request. The text below is a copy of the complete page <?php include("includes/db.config.php"); if(checkuser()){ $query = "SELECT * FROM log WHERE DateOpened BETWEEN $date_1 AND $date_2 ORDER DateOpened DESC"; $result = mysql_query($query); if(!$result) { //There was a database error echo "Query: $query<br>Error: " . mysql_error(); } elseif(!mysql_num_rows($result) { echo "There were no results"; } else { while($row = mysql_fetch_assoc($result)) { echo "results"; //Do something with the data } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- DW6 --> <head> <title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Robots" content="all"> <meta name="Revisit-After" content="3 days"> <meta name="keywords" content="Automation"> <meta name="description" content="Automation"> <meta name="Author" content="Gary Needham"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="css/test.css" type="text/css"> <!--Start config --> <?php $include_top_right_links = true; $include_header = true; $include_banner = true; $include_top_links = false; $include_top_links_data = true; $include_left_box_spacer = true; $include_right_box_spacer = false; $include_left_box = false; $include_right_box = false; $include_footer = true; $include_left_box_blank= true; ?> <!--End config --> <!--Start top right Div --> <?php if ($include_top_right_links && file_exists("ocado/add_top_right_links.php")) { include("ocado/add_top_right_links.php"); } ?> <!--End top right links Div --> <!--Start Header Div --> <?php if ($include_header && file_exists("ocado/add_header.php")) { include("ocado/add_header.php"); } ?> <!--End Header Div --> <!--Start spacer Div --> <?php if ($include_banner && file_exists("ocado/add_banner.php")) { include("ocado/add_banner.php"); } ?> <!--Send spacers Div --> <!--Start Top links Div --> <?php if ($include_top_links && file_exists("ocado/add_links_top.php")) { include("ocado/add_links_top.php"); } ?> <!--End Top links Div --> <!--Start Top links data Div --> <?php if ($include_top_links_data && file_exists("ocado/add_links_top_data.php")) { include("ocado/add_links_top_data.php"); } ?> <!--End Top links data Div --> <!--Start Left links Spacer Div --> <?php if ($include_left_box_spacer && file_exists("ocado/add_box_left_spacer.php")) { include("ocado/add_box_left_spacer.php"); } ?> <!--End Left links Spacer Div --> <!--Start Left box Div --> <?php if ($include_left_box && file_exists("/ocado/add_box_left.php")) { include("/ocado/add_box_left.php"); } ?> <!--End Left box Div --> <!--Start Left box Blank Div --> <?php if ($include_left_box_blank && file_exists("ocado/add_left_links_blank.php")) { include("ocado/add_left_links_blank.php"); } ?> <!--End Left box Blank Div --> </head> <body> <div id="body"class="body_text"> <table width="661" border="0"> <tr> <td colspan="2"><form> <span class="ContentStyle">Start date </span><span class="style4"> </span> <input name="date_1" type="date" value="<%=date_1%>" size="15" /> <span class="ContentStyle">End date </span><span class="style4"> </span> <input name="date_2" type="date" value="<%=date_2%>" size="15" /> <input name="submit" type="submit" value="Search"> <span></span> </form></td> </tr> <tr bgcolor="#EAEAEA"> <td> </td> <td><div align="center"><a href="ocado_edit_my_log.php?id=<?=$r['id']?>">Edit</a> | <a href="singlelog.php?id=<?=$r['id']?>">View / Print </a></div></td> <tr> <td width="533"><strong>PLC</strong></td> <td width="118"> </td> </tr> <tr> <td><a href="singlelog.php?id=<?=$r['id']?>"><?=$r['Description']?></a></td> <td> </td> </tr> <tr> <td><strong>Raised by </strong></td> <td> </td> </tr> <tr> <td><?=$r['Raised_by']?></td> <td> </td> </tr> <tr> <td><strong>Block</strong></td> <td> </td> </tr> <tr> <td><?=$r['Block']?></td> <td> </td> </tr> <tr> <td><strong>Date Raised</strong></td> <td> </td> </tr> <tr> <td><?=$r['DateOpened']?></td> <td> </td> </tr> <tr> <td><strong>Date closed </strong></td> <td> </td> </tr> <tr> <td><?=$r['DateClosed']?></td> <td> </td> </tr> <tr> <td><strong>Description of problem </strong></td> <td> </td> </tr> <tr> <td><a href="singlelog.php?id=<?=$r['id']?>"> <?=$r['Description']?> </a></td> <td> </td> </tr> <tr> <td><strong>Equipment</strong></td> <td> </td> </tr> <tr> <td><?=$r['Equipment']?></td> <td> </td> </tr> </tr> <tr bgcolor="#000040"> <td height="1" colspan="2"></td> </tr> </table> </div> </body> <!--Start Right links Spacer Div --> <?php if ($include_right_box_spacer && file_exists("ocado/add_box_right_spacer.php")) { include("ocado/add_box_right_spacer.php"); } ?> <!--End Right links Spacer Div --> <!--Start Right links Div --> <?php if ($include_right_box && file_exists("ocado/add_box_right.php")) { include("ocado/add_box_right.php"); } ?> <!--End Right links Div --> <!--Start Footer Div --> <?php if ($include_footer && file_exists("ocado/add_footer.php")) { include("ocado/add_footer.php"); } ?> <!--End Footer Div --> <?php }else{ header("Location:asd.php"); } ?> </html>
-
Thanks I have changed to the following but still will not run the search $sql = "select * from log where DateOpened > $date_1 and DateOpened < $date_2 order by DateOpened desc; "; if (empty($_GET['DateOpened'])) $sql = "SELECT * FROM DateOpened WHERE 1 = 2 "; $res = mysql_query($sql); <form> <span class="ContentStyle">Start date </span><span class="style4"> </span> <input name="date_1" type="date" value="<%=date_1%>" size="15" /> <span class="ContentStyle">End date </span><span class="style4"> </span> <input name="date_2" type="date" value="<%=date_2%>" size="15" /> <input name="submit" type="submit" value="Search"> <span></span> </form> <?php while ($r = mysql_fetch_assoc($res)) { ?>
-
Hi Can anyone please help? I want to search between two dates from a date opened I have the following code but sadly is not working $sql = "SELECT * FROM Log WHERE Date_Opened = '" BETWEEN '" & Date_1 & "' AND '" & Date_2 & "'" ORDER BY DateOpened DESC "; if (empty($_GET['Date_Opened'])) $sql = "SELECT * FROM Date_opened WHERE 1 = 2 "; $res = mysql_query($sql); <form> Start Date:<input name="Date_1" type="Date" value="<%=Date_1%>" size="15" /> End Date:<input name="Date_2" type="Date" value="<%=Date_2%>" size="15" /> <input name="Submit" type="submit" /> </form>
-
Hi Can anyone help with the following? I want to add a popup message to confirm the deleting of a record What code do I need to add to this <?php include_once ("includes/db.config.php"); mysql_query("DELETE FROM log WHERE id = '{$_GET['id']}' "); mysql_close(); // re-direct header("Location: log.php"); exit; ?>