•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 373,936 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,528 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 311 | Replies: 1
![]() |
•
•
Join Date: Mar 2008
Posts: 8
Reputation:
Rep Power: 0
Solved Threads: 0
hello to every body,
i have a problem in mysql database
i dont know where i made mistake, i wrote a database this one dow,
please show me where is my mistake or how i can use in simple way
i have a problem in mysql database
i dont know where i made mistake, i wrote a database this one dow,
please show me where is my mistake or how i can use in simple way
php Syntax (Toggle Plain Text)
<? trim($searchterm); if (!$searchtype || !$searchterm) { echo "You have not enter search details. please go back and try again."; exit; } $searchtype=addslashes($searchterm); $searchtype=addslashes($searchterm); @ $db=mysql_pconnect("localhost","root","cmax"); if (!$db) { echo "Error:could not connect to database.please try again later."; exit; } mysql_select_db("book"); $query="select*from books where ".$searchtype." like '%".$searchterm."%'"; $num_results=mysql_num_rows($result); echo "<p>Number of book found: ".$num_results."</p>"; for ($i=0; $i <$num_results; $i++) { $row=mysql_fetch_array($result); echo "<p><strong>".($i+1).".Title: "; echo htmlspecialchars( stripslashes($row["title"])); echo "</strong><br>Author: "; echo htmlspecialchars (stripslashes($row["author"])); echo "<br>ISBN: "; echo htmlspecialchars (stripslashes($row["isbn"])); echo "<br>price: "; echo htmlspecialchars (stripslashes($row["price"])); echo "</p>"; } ?>
Last edited by peter_budo : Apr 22nd, 2008 at 5:10 am. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Dec 2007
Posts: 102
Reputation:
Rep Power: 1
Solved Threads: 12
What do you expect from the code and how it is behaving?
php Syntax (Toggle Plain Text)
trim($searchterm); should be $searchterm = trim($searchterm);
Last edited by peter_budo : Apr 22nd, 2008 at 5:11 am. Reason: Keep It Organized - please use [code] tags
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
Similar Threads
- PHP/MySQL Programmer Position (Web Development Job Offers)
- PHP MYSQL Developer Position Available (Web Development Job Offers)
- SQL Server vs MYSQL vs MSQL (i'm stopping now) (MS SQL)
Other Threads in the MySQL Forum
- Previous Thread: About PL/SQL
- Next Thread: absolute paths


Linear Mode