Hi...
I have the following code...

case 10:
					if($uid=$_GET['u'] && $pid=$_GET['p'] && $t=$_GET['ti'] && $type=$_GET['typ'])
					{
						print "$uid  $pid $t $type  ";
					} 
					
					
					$query1="select * from album";
					$result1=mysql_query($query1);
					if(mysql_num_rows($result1)>0)
					{
						$i=1;
						print "<table width='1000px' cellspacing='10px' cellpadding='10px' align='center'><tr><td colspan='4' class='h1'>Click on an image to delete it..</td></tr><tr>";
						while($row1=mysql_fetch_array($result1))
						{
							
							$query3="select * from users where id = '$row1[login]'";
							$result3=mysql_query($query3);
							$row3=mysql_fetch_array($result3);							
							
							if($row3[type]==1)
							$query2="select * from artist where login = $row1[login]";
							else
							$query2="select * from listener where login = $row1[login]";
							
							$result2=mysql_query($query2);
														
							
							while($row2=mysql_fetch_array($result2))
							{
								print "<td><table class='ranprof'>";		
								print "<tr><td align='center'><a href='../album/$row1[image_thumb]' target='_blank'><img src='../album/timthumb.php?src=../album/"; print "$row1[image_thumb]&h=110&w=110&zc=1' border='0px' align='absmiddle' title='Click to view large picture'></a></td></tr>";																						
								print "<tr><td class='h2'><small>Uploaded by:</small><a href='profile.php?id=$row2[login]' target='_blank'>$row2[fname] $row2[lname]</a></td></tr>";
								print "<tr><td align='center' class='h2'><a href='index.php?u=$row1[login]&cat=10&p=$row1[id]&ti=$row1[image_thumb]&typ=$row3[type]'><img src='i/del_ico.png' width='15px' height='15px' border='0px'/>&nbsp;&nbsp;Delete</a></td></tr>";
								print "</table></td>";

								
								if($i%4==0)
								print "</tr><tr>";
								$i++;								
							}
						}
						print "</tr><tr><td colspan='4'><div id='FullPic'><div id='fullPic'></div></div></td></tr></table>";
					}
					else
					{
						print "<i>NO images uploaded.</i>";
					}
					break;

when i try to print all the get values they are all 1's... actual values should be some string and a set of values...I am unable solve this problem.. Need help..

Thanks in Advance...

Recommended Answers

All 5 Replies

if($uid=$_GET['u'] && $pid=$_GET['p'] && $t=$_GET['ti'] && $type=$_GET['typ']) You are setting values instead of comparing them. To compare, use if($uid==$_GET['u'] && $pid==$_GET['p'] && $t==$_GET['ti'] && $type==$_GET['typ'])

I am setting.. and not comparing.. However, the problem is solved when i set $type before every other variables....

if($uid=$_GET['u'] && $pid=$_GET['p'] && $t=$_GET['ti'] && $type=$_GET['typ'])

- This gave me values of all get values as 1

when i change it to

if($type=$_GET['typ'] && $uid=$_GET['u'] && $pid=$_GET['p'] && $t=$_GET['ti'])

- it is giving correct values...

Can somebody explain why this is happening..

Thanks buddylee17 :)

Wow that's crazy. It shouldn't matter what order you assign the values. huh

case 10:
				     //1. use mysql_real_escape_string to avoid sql injection attacks
					//2. if you actually meant to assign values, you do NOT need an if
					$uid=mysql_real_escape_string($_GET['u']);
					$pid=mysql_real_escape_string($_GET['p']);
					$t=mysql_real_escape_string($_GET['ti']);
					$type=mysql_real_escape_string($_GET['typ']);

					//you can check if at least one of the values were empty as follows
					if( empty($uid) || empty($pid) || empty($t) || !empty($type) )
					{
						print "At least one parameter was empty: $uid  $pid $t $type  ";
					} 
					
					
					$query1="select * from album";
					$result1=mysql_query($query1);
					if(mysql_num_rows($result1)>0)
					{
						$i=1;
						print "<table width='1000px' cellspacing='10px' cellpadding='10px' align='center'><tr><td colspan='4' class='h1'>Click on an image to delete it..</td></tr><tr>";
						while($row1=mysql_fetch_array($result1))
						{
							
							$query3="select * from users where id = '$row1[login]'";
							$result3=mysql_query($query3);
							$row3=mysql_fetch_array($result3);							
							
							if($row3[type]==1)
							$query2="select * from artist where login = $row1[login]";
							else
							$query2="select * from listener where login = $row1[login]";
							
							$result2=mysql_query($query2);
														
							
							while($row2=mysql_fetch_array($result2))
							{
								print "<td><table class='ranprof'>";		
								print "<tr><td align='center'><a href='../album/$row1[image_thumb]' target='_blank'><img src='../album/timthumb.php?src=../album/"; print "$row1[image_thumb]&h=110&w=110&zc=1' border='0px' align='absmiddle' title='Click to view large picture'></a></td></tr>";																						
								print "<tr><td class='h2'><small>Uploaded by:</small><a href='profile.php?id=$row2[login]' target='_blank'>$row2[fname] $row2[lname]</a></td></tr>";
								print "<tr><td align='center' class='h2'><a href='index.php?u=$row1[login]&cat=10&p=$row1[id]&ti=$row1[image_thumb]&typ=$row3[type]'><img src='i/del_ico.png' width='15px' height='15px' border='0px'/>&nbsp;&nbsp;Delete</a></td></tr>";
								print "</table></td>";

								
								if($i%4==0)
								print "</tr><tr>";
								$i++;								
							}
						}
						print "</tr><tr><td colspan='4'><div id='FullPic'><div id='fullPic'></div></div></td></tr></table>";
					}
					else
					{
						print "<i>NO images uploaded.</i>";
					}
					break;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.