Jump to content

Help Please With URL %20


just me and php

Recommended Posts

Im New At This Stuff And Have Gotten Alot Of Good Coding Ideas From These Forums , But Im Having A Problem With This, Is There A Code That I Can Insert Some Where In This Code Below So When URL Is Something Like php?id=Who%20Hit%20Fosty%20hohoho It Doesnt See The %20 ?

[code]
require('include/init.inc.php');
pageheader(Fotoindex);

$srch = 'filename';
$p_id = $_GET['id'];
$result = mysql_query("SELECT * from {$CONFIG['TABLE_PICTURES']} , {$CONFIG['TABLE_ALBUMS']}  where ".$srch." LIKE '%".$p_id."%'  limit 1 ");

starttable("");

  while ($row = mysql_fetch_array($result))
{

echo "<tr><td><a href=\"displayimage.php?pos=-$row[pid]\" filename=\"$row[filename]\">$row[filename]</a></td></tr>\n";
     
}
               
endtable();
pagefooter();
[/code]
Link to comment
https://forums.phpfreaks.com/topic/29462-help-please-with-url-20/
Share on other sites

You should not need to worry about the %20's with $_GET['id'];  Are you saying you don't want to see the %20 in the URL?

Print out the var to see what it looks like
[code]$p_id = $_GET['id'];
print("<hr>p_id: $p_id<hr>");[/code]

If that looks fine then change this line
[code]$result = mysql_query("SELECT * from {$CONFIG['TABLE_PICTURES']} , {$CONFIG['TABLE_ALBUMS']}  where ".$srch." LIKE '%".$p_id."%'  limit 1 ");
[/code]

to this
[code]$tbl_sql = "SELECT * from {$CONFIG['TABLE_PICTURES']} , {$CONFIG['TABLE_ALBUMS']}  where ".$srch." LIKE '%".$p_id."%'  limit 1 ";
print ("<hr>SQL: $tbl_sql<hr>");
$result = mysql_query( $tbl_sql );[/code]

If the sql looks good there then just comment out the [b]print ("<hr>SQL: $tbl_sql<hr>");[/b]

-John



Thanks Guys And jsladek  You Showed Me Something That I Always Wanted To Know How To Do , Print Url And See The Output,And Your Right The %20's Are Not There.
Unfortionly It Looks Like What Im Trying To Do Is In Possible.
I Have Over 5000 Diff FileNames In Data Base And They Are All Diff From My URL
Example url beeper(db name beeper<--No Problem), url beep beep(db name Beep Beep<--Problem), url beep_beeper(db name BeepBeeper<--Problem),url beepbeepers(db name Beep_Beepers<--Problem)
i have to many url names that really dont match db names.
Thanks Again For Helping ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.