» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > PHP Programming and Tips

PHP Programming and Tips Discuss about PHP programming and Share Tips. Ask questions about Scripting and Errors.

Reply
 
Thread Tools Display Modes
  #1  
Old 07-30-2006, 11:06 AM
splendor splendor is offline
Junior Member
 
Join Date: Jul 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
splendor is on a distinguished road
Default PHP/MySql problems

Here is my code:


PHP Code:
$id = $_GET['id']; // The item id //
$name = $_REQUEST['item']; // Name of the item //
$amount = $_POST['amount'];

$owner = $_REQUEST['owner']; // The obj_id of the character (owner) //

// Check if we already have a script for this item //
if (!file_exists("store_items/$name.php"))
{
// If we do not, copy the template script and rename it to this item's name //
copy("store_items/template.php", "store_items/$name.php");
}


It works fine, except for when an item contains a ' in it. For some reason the ' jacks everything up. This also jacks all other mysql queries because all that's getting inserted is "john" instead of "john's item" -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 07-30-2006, 11:08 AM
cook cook is offline
OSP Starters
 
Join Date: Jul 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
cook is on a distinguished road
Default

Splendor, welcome to this forum

You need to use mysql_escape_string() in your queries where you expect a string with a ' in it. The single quote is used to SQL to enclose a string, so if you get one passed from php, then it thinks it's reached the end of a string.

Glad to help you -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
my coding with PHP/MySQL and was wondering hannah PHP Programming and Tips 2 09-23-2006 12:52 PM
problems with Google Toolbar recently? hunter Google 3 09-18-2006 02:19 PM
new host problems? Janae Web Hosting Industry 1 08-12-2006 08:37 AM
Deletion causes problems! Jaelyn MySQL Forums 1 08-08-2006 07:05 AM
problems with damlogs???? Katlyn Web Hosting Industry 1 08-07-2006 04:56 AM


All times are GMT. The time now is 07:52 PM.