HostKube

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
php mysql run script with spaces
07-02-2009, 02:43 AM
Post: #1
Shy php mysql run script with spaces
can anyone tell me how to run a script that pulls from mysql where the variable has a space... the script stops at

phone_notes.php?manufacturer=test&model=m800

its suppose to be:

phone_notes.php?manufacturer=test&model=m800 instinct

Can someone tell me how to put something in my script that will grab the whole variable.
Find all posts by this user
Quote this message in a reply
07-02-2009, 11:39 PM
Post: #2
RE: php mysql run script with spaces
well in php you should just be able to use $_GET['model']

however you may be having problems because that the url is not url encoded.

really it should be like

phone_notes.php?manufacturer=test&model=m800%20instinct

and the %20 is converted to a space.

Check out php.net/urlencode

[Image: poweredby.jpg]

Lockerz Invites!
Visit this user's website Find all posts by this user
Quote this message in a reply
07-03-2009, 12:05 AM
Post: #3
RE: php mysql run script with spaces
that deffinately sounds like what I am looking for... so heres how my current script works:

This link retrieves model names from a database

echo"<a href=phone_notes.php?manufacturer=$manufacturer&amp;model={$model[0]}>$model[0]</a><br>";

when the user clicks on it, it retrieves the notes for that model. The problem I'm having is when a model is named something like "m800 instinct" the url will stop at

phone_notes.php?manufacturer=LG&model=ax

its suppose to be

phone_notes.php?manufacturer=LG&model=ax 260 scooplx 260 rumor

thanks for your help
Find all posts by this user
Quote this message in a reply
07-04-2009, 09:24 PM
Post: #4
RE: php mysql run script with spaces
change it to this:

PHP Code:
echo "<a href=phone_notes.php?manufacturer=" urlencode($manufacturer) . "&amp;model=" urlencode($model[0]) . ">" urlencode($model[0]) . "</a><br>"

[Image: poweredby.jpg]

Lockerz Invites!
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
Exclamation Boonex Dolphin PHP script is SCAM!!! robertbowie 0 134 02-05-2010 03:33 PM
Last Post: robertbowie
  Php Email Script not working lc23 5 417 09-06-2009 11:32 PM
Last Post: goughy000
  php/mysql sort help.... syntax24 4 484 03-09-2009 01:03 AM
Last Post: goughy000
  PHP MYSQL help please project_syntax 11 1,144 01-02-2009 05:02 PM
Last Post: Josh Connerty
rofl mysql update where id=$id slangnit 5 673 10-21-2008 01:46 AM
Last Post: slangnit
Shy I need a good pic resize and upload script slangnit 4 761 10-06-2008 06:42 PM
Last Post: goughy000

Forum Jump:

Contact UsByte ForumsReturn to TopReturn to ContentLite (Archive) ModeRSS Syndication