Jump to content

need someone to help me on a peace of code for a php script


gene4848

Recommended Posts

Im needing help on one more major problem with my classified ad php software ,heres the problem: when some one joins for free and they get one of the ad packages weather it be 25 credits or ten all the other members get the same credit qty updat  as the ones you buy,other wards, if one member has 25 credits in there account and the other member buys 50 that other members acount updates to the same qty?how do you fix the credit problem they give the same credit amout to all users plus or minus this is useless please give the fix info for this see for your selflink below:

 

http://www.copylathe.com/post/index.php

note i dont know where to begine i know itys not the mysql data base ,i elimated that,

 

 

it might be in these two php files/pages  can some one look at it and see if its right? or see where the problem is ? the first page is called :selectpackage) second page is called (detail) you guys are my last resort .

 

1) seleckpackage:

 

<?php 
session_start();
if(!isset($_SESSION['session_login']) || $_SESSION['session_login'] == "")
	header("Location:loginform.php?errFlag=1");

require("include/conn.php");

?>
<html>
<head>
<title>Online Classifieds; Add Advertisment</title>
<link href="include/style.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff" style="text-align: center" topmargin="0">
<table width="780"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2"><?php include("include/top.php"); ?></td>
  </tr>
  <tr>
    <td width="224" valign="top" bgcolor="#E8E3E8"><? require("include/left.php");?></td>
    <td width="560" valign="top">
<table width="98%"  border="0" align="center" cellpadding="2" cellspacing="0" class="brd">
      <tr>
        <td bgcolor="#B3A2B2" class="whitetxt">Select Package</td>
      </tr>
      <?
  	
/* 		$sql = "SELECT * FROM page_text WHERE page_id=1";
	$result = mysql_query($sql) or die(mysql_error());
	$qr = mysql_fetch_array($result);
	$page_text = $qr['page_text'];
*/	  
  ?>
      <tr>
        <td height="23"><br><form action="save_ad.php" method="post" name="frm_ad" onSubmit="return validateForm(this);">
          <table width="90%"  border="0" align="center" cellpadding="3" cellspacing="0" class="brd">
            <tr bgcolor="#E0D2DF">
              <td width="33%" class="blacktxt">Package Name</td>
              <td width="28%" class="blacktxt"><div align="center">No of Credits</div></td>
              <td width="12%" class="blacktxt">Price</td>
              <td class="blacktxt"><div align="center">Pic.View Detail </div></td>
            </tr>
            <? 
	$result=mysql_query("Select * from packages order by amount asc");		  
	$rc=mysql_num_rows($result);
	while($qr = mysql_fetch_array($result)) {
	?>
            <tr>
              <td height="5" colspan="4"></td>
            </tr>
            <tr class="leftlinks">
              <td><? echo $qr["title"]; ?> </td>
              <td><div align="center"><a href="detail.php?sid=<?=$qr['siteid']?>" class="leftlinks">
                  <?=$qr['no_days'];?>
              </a></div></td>
              <td>$<?=$qr['amount']?>
              </td>
              <td><div align="center"><A href="paypal.php?pkid=<? echo $qr["packageid"];?>"><font color="#000000">Buy
                    Now</font></A></div></td>
            </tr>
            <? }?>
          </table>
        </form></td>
      </tr>
      <tr>
        <td class="leftlinks"> </td>
      </tr>
      <tr>
        <td align="right"></td>
      </tr>
    </table>
<br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br></td>
  </tr>
  <tr>
    <td colspan="2"> </td>
  </tr>
  <tr>
    <td colspan="2"> </td>
  </tr>
  <tr>
    <td colspan="2" bgcolor="#E0D2DF"><? require("include/footer.php");?></td>
  </tr>
</table>
</body>
</html> 
Reply Quote Notify  

2   PHP Applications, Frameworks and Libraries / Third Party PHP Scripts / Re: need urgent help with php classified script php myacount mode  on: December 20, 2008, 05:20:25 PM  
Quote from: gene4848 on December 20, 2008, 08:27:26 AM
i think you might be on to something there redarrow  refrer to (points=points+$added_points where user_id='$user_id') instead of points it might be refrered to as credits : not sure witch php page contanes this ill send you the user select packackage page :below:

Please i hope youguys do,nt give up on me, these last two php files i think the problem is in these.files names detail and selectpackage.
Code: (php) [select] 

 

2) Detail:

 

<? 
ob_start();
session_start();
require("include/conn.php");


$sql = "SELECT sitehits FROM ad WHERE siteid=".$_GET['sid'];
$row_hit = mysql_query($sql) or die(mysql_error());
$qr_hit = mysql_fetch_array($row_hit);

$sitehits = $qr_hit['sitehits'];

if(!isset($_COOKIE['vote']) || $_COOKIE['vote'] != $_GET['sid']){

	$new_hits = $sitehits + 1;

	$sql = "UPDATE ad SET sitehits =".$new_hits." WHERE siteid=".$_GET['sid'];
	mysql_query($sql) or die(mysql_error());


setcookie('vote',$_GET['sid'], time()+60*60*24,'/');

}

?>
<html>
<head>
<title>Online Classifieds; Ad Details</title>
<link href="include/style.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff" style="text-align: center" topmargin="0">
<table width="780"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><?php include("include/top.php"); ?></td>
  </tr>
  <tr>
    <td align="center"> 	</td>
  </tr>
  <tr>
    <td align="center"> </td>
  </tr>
  <tr>
    <td align="center"><table width="96%"  border="0" cellpadding="3" cellspacing="0" class="brd">
      <? 
  
  	$sql = "SELECT * FROM ad WHERE approve=1 and siteid=".$_GET['sid'];
	$row = mysql_query($sql) or die(mysql_error());
	$qr = mysql_fetch_array($row);
	if (mysql_num_rows($row) < 1) 
	{
		header("Location: index.php");
	}
  
/** FOR CAT NAME *************************************/
  	$sql_cat = "SELECT catname FROM category WHERE catid =".$qr['sitecatid'];
	$row_cat = mysql_query($sql_cat) or die(mysql_error());
	$qr_cat = mysql_fetch_array($row_cat);
  
  ?>
      <tr>
        <td colspan="2" bgcolor="#E0D2DF" class="blackhead">
          <?=$qr_cat['catname']?>
           > 
          <?=$qr['sitetitle']?>
        </td>
      </tr>
      <tr>
        <td height="10" colspan="2"></td>
      </tr>
      <tr>
        <td width="63%" valign="top"><table width="100%"  border="0" cellpadding="3" cellspacing="0" class="brd">
          <tr>
            <td bgcolor="#E0D2DF" class="blacktxt">Description</td>
          </tr>
          <tr>
            <td class="leftlinks"><?=$qr['sitedescription']?></td>
          </tr>
          <tr>
            <td height="10"></td>
          </tr>
          <tr>
            <td bgcolor="#E0D2DF" class="blacktxt">General Details</td>
          </tr>
          <tr>
            <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr class="leftlinks">
                <td width="30%">Sold By </td>
                <td width="70%"><? 

							$sql_mem = "SELECT name FROM users WHERE email='".$qr['ad_username']."'";
							$row_mem = mysql_query($sql_mem) or die(mysql_error());
							$qr_mem = mysql_fetch_array($row_mem);

							echo($qr_mem['name']);
						?>
                </td>
              </tr>
              <tr class="leftlinks">
                <td>Email </td>
                <td><a href="contact_seller.php?sid=<?=$_GET['sid']?>" class="leftlinks">Contact Seller</a> </td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td height="10"></td>
          </tr>
          <tr>
            <td bgcolor="#E0D2DF" class="blacktxt">Ad Details </td>
          </tr>
          <tr>
            <td><table width="70%"  border="0" cellspacing="0" cellpadding="0">
              <tr class="leftlinks">
                <td width="30%">Ad Id </td>
                <td width="70%"><?=$qr['siteid']?></td>
              </tr>
              <tr class="leftlinks">
                <td>Ad Views </td>
                <td><?=$sitehits?></td>
              </tr>
              <tr class="leftlinks">
                <td>Ad Expires </td>
                <td class="blacktxt">
                  <? 
				$expire_days = $qr['expire_days'];
				echo $prev_date = date("d.m.Y",strtotime ("+$expire_days day",mktime(0,0,0,substr($qr['sitedate'],3,2),substr($qr['sitedate'],0,2),substr($qr['sitedate'],6,4))));
			?>
                </td>
              </tr>
              <tr class="leftlinks">
                <td>Added</td>
                <td><?=$qr['sitedate']?></td>
              </tr>
              <tr class="leftlinks">
                <td>Country</td>
                <td><?=$qr['country']?></td>
              </tr>
              <tr class="leftlinks">
                <td>State</td>
                <td><?=$qr['state']?></td>
              </tr>
              <tr class="leftlinks">
                <td>City</td>
                <td><?=$qr['city']?></td>
              </tr>
              <tr class="leftlinks">
                <td> </td>
                <td> </td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td> </td>
          </tr>
  <?
  if(isset($_SESSION['session_login'])){
  
  	$sql = "SELECT * FROM favourites WHERE f_adid=".$_GET['sid']." AND femail = '".$_SESSION['session_login']."'";
	$result_fav = mysql_query($sql) or die(mysql_error());
	if(mysql_num_rows($result_fav) == 0){
  
  ?>
          <tr>
            <td class="blacktxt"><a href="ad_favorite.php?sid=<?=$_GET['sid']?>" class="blacktxt"><img src="images/bookmark.gif" width="20" height="20" border="0"> Add to Favorites </a></td>
          </tr>
<?
	}else{

?>
          <tr>
            <td class="blacktxt"><a href="ad_favorite.php?sid=<?=$_GET['sid']?>&id=r" class="blacktxt"><img src="images/bookmark.gif" width="20" height="20" border="0"> Remove from Favorites </a></td>
          </tr>
    <?
	}

}
?>
	  
        </table></td>
        <td width="37%" valign="top"><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="brd">
	<?
		$sql_img = "SELECT * FROM picture WHERE pictures_siteid=".$qr['siteid']." ORDER BY id DESC LIMIT 0,3";
		$row_img = mysql_query($sql_img) or die(mysql_error());
		//$qr_img = mysql_fetch_array($row_img);
		if(mysql_num_rows($row_img) == 0){
	?>
          <tr>
            <td align="center" class="leftlinks"><br><br><br>No Images Available!<br><br><br></td>
          </tr>
          <tr>
            <td height="10"></td>
          </tr>

	<?
		}else{
			while($qr_img = mysql_fetch_array($row_img)){
				if($qr_img['filename'] != "") {
	?>
          <tr>
            <td align="center"><a href="ad_images/<? echo($qr_img['filename']);?>" target="_blank"><img src="ad_images/<? echo($qr_img['filename']);?>" width="100px" border="0"></a></td>
          </tr>
          <tr>
            <td height="10"></td>
          </tr>
	<? 
				}
			}
		}

	?>		  
        </table></td>
      </tr>
      <tr>
        <td colspan="2"> </td>
      </tr>
      <tr>
        <td colspan="2"> </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td> </td>
  </tr>
  <tr>
    <td align="center"><table width="98%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="24%" align="center" valign="top"><a href="search.php?cid=<?=$qr['sitecatid']?>" class="leftlinks"><img src="images/icon_moreadsincat.gif" width="32" height="32" border="0" align="middle"> More ads in this Category</a> </td>
        <td width="24%" align="center"><a href="search.php?sid=<?=$_GET['sid']?>" class="leftlinks"><img src="images/icon_adsfromseller.gif" width="32" height="32" border="0" align="middle"> Ads from this seller</a> </td>
        <td width="27%" align="center"><a href="contact_seller.php?sid=<?=$_GET['sid']?>" class="leftlinks"><img src="images/icon_contactsalesperson.gif" width="32" height="32" border="0" align="middle"> Contact Seller</a></td>
        <td width="25%" align="center"><a href="tell_friend.php?sid=<?=$_GET['sid']?>" class="leftlinks"><img src="images/icon_tellafriend.gif" width="32" height="32" border="0" align="middle"> Tell a Friend</a> </td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td> </td>
  </tr>
  <tr>
    <td bgcolor="#E0D2DF"><? require("include/footer.php");?></td>
  </tr>
</table>
</body>
</html> 
Report to moderator    64.223.121.82 
gene4848
New Member 
Online 
Posts: 6 

   Re: need urgent help with php classified script php myacount mode 
« Reply #5 on: December 20, 2008, 05:20:25 PM »
Quote Quote from: gene4848 on December 20, 2008, 08:27:26 AM

Link to comment
Share on other sites

it might be in these two php files/pages  can some one look at it and see if its right? or see where the problem is ?

 

Add this to the top of your script and see if there are any errors.  You should be debugging, echoing things out to figure out what is wrong.

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

 

BTW, it's "piece" not "peace"...

Link to comment
Share on other sites

Hi I did thaT to the detail php page erro message as follows:

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=

Notice: Undefined index: siteid in /home/content/g/m/d/gmdist' at line 1

 

 

What dose this mean ???

Link to comment
Share on other sites

It means that your query has a syntax error.

 

$sql = "UPDATE ad SET sitehits =".$new_hits." WHERE siteid=".$_GET['sid'];

Needs to be

 

$sql = "UPDATE ad SET sitehits = '$new_hits'  WHERE siteid='$_GET['sid']' ";

And you should not use the $_POST / $_GET superglobals directly in a query. You should set them as vars before the query and then use that var. Also use mysql_real_escape_string() or add_slashes() to the vars to sanitize them.

 

Nate

Link to comment
Share on other sites

I did what you said I replaced the line in detail with the one you left I then got this erro:

 

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/g/m/d/gmdistributors/html/post/detail.php on line 9

 

whats this one mean?

Link to comment
Share on other sites

It means this

$sql = "UPDATE ad SET sitehits = '$new_hits'  WHERE siteid='$_GET['sid']' ";


should be this
<?php

$sid = mysql_real_escape_string($_GET['sid']);

$sql = "UPDATE ad SET sitehits = '$new_hits'  WHERE siteid='$sid' ";

?>

 

The error was because of single quotes around an array item  '$_GET['sid']'...

 

T_ENCAPSED_AND_WHITESPACE pretty much is the dead giveaway that you have an array item (using single quotes) surrounded with single quotes.

 

Nate

Link to comment
Share on other sites

I got this message now :

 

Notice: Undefined variable: new_hits in /home/content/g/m/d/gmdistributors/html/post/detail.php on line 9

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/g/m/d/gmdistributors/html/post/detail.php on line 12

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=

Notice: Undefined index: siteid in /home/content/g/m/d/gmdist' at line 1

Link to comment
Share on other sites

here is how i imported the code in:

 

 

<? 
ini_set ("display_errors", "1");
error_reporting(E_ALL);
ob_start();
session_start();
require("include/conn.php");
$sid = mysql_real_escape_string($_GET['sid']);

$sql = "UPDATE ad SET sitehits = '$new_hits'  WHERE siteid='$sid' ";

$row_hit = mysql_query($sql) or die(mysql_error());
$qr_hit = mysql_fetch_array($row_hit);

$sitehits = $qr_hit['sitehits'];

if(!isset($_COOKIE['vote']) || $_COOKIE['vote'] != $_GET['sid']){

	$new_hits = $sitehits + 1;

	$sql = "UPDATE ad SET sitehits =".$new_hits." WHERE siteid=".$_GET['sid'];
	mysql_query($sql) or die(mysql_error());


setcookie('vote',$_GET['sid'], time()+60*60*24,'/');

}

?>
<html>
<head>
<title>Online Classifieds; Ad Details</title>
<link href="include/style.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff" style="text-align: center" topmargin="0">
<table width="780"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><?php include("include/top.php"); ?></td>
  </tr>
  <tr>
    <td align="center"> 	</td>
  </tr>
  <tr>
    <td align="center"> </td>
  </tr>
  <tr>
    <td align="center"><table width="96%"  border="0" cellpadding="3" cellspacing="0" class="brd">
      <? 
  
  	$sql = "SELECT * FROM ad WHERE approve=1 and siteid=".$_GET['sid'];
	$row = mysql_query($sql) or die(mysql_error());
	$qr = mysql_fetch_array($row);
	if (mysql_num_rows($row) < 1) 
	{
		header("Location: index.php");
	}
  
/** FOR CAT NAME *************************************/
  	$sql_cat = "SELECT catname FROM category WHERE catid =".$qr['sitecatid'];
	$row_cat = mysql_query($sql_cat) or die(mysql_error());
	$qr_cat = mysql_fetch_array($row_cat);
  
  ?>
      <tr>
        <td colspan="2" bgcolor="#E0D2DF" class="blackhead">
          <?=$qr_cat['catname']?>
           > 
          <?=$qr['sitetitle']?>
        </td>
      </tr>
      <tr>
        <td height="10" colspan="2"></td>
      </tr>
      <tr>
        <td width="63%" valign="top"><table width="100%"  border="0" cellpadding="3" cellspacing="0" class="brd">
          <tr>
            <td bgcolor="#E0D2DF" class="blacktxt">Description</td>
          </tr>
          <tr>
            <td class="leftlinks"><?=$qr['sitedescription']?></td>
          </tr>
          <tr>
            <td height="10"></td>
          </tr>
          <tr>
            <td bgcolor="#E0D2DF" class="blacktxt">General Details</td>
          </tr>
          <tr>
            <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr class="leftlinks">
                <td width="30%">Sold By </td>
                <td width="70%"><? 

							$sql_mem = "SELECT name FROM users WHERE email='".$qr['ad_username']."'";
							$row_mem = mysql_query($sql_mem) or die(mysql_error());
							$qr_mem = mysql_fetch_array($row_mem);

							echo($qr_mem['name']);
						?>
                </td>
              </tr>
              <tr class="leftlinks">
                <td>Email </td>
                <td><a href="contact_seller.php?sid=<?=$_GET['sid']?>" class="leftlinks">Contact Seller</a> </td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td height="10"></td>
          </tr>
          <tr>
            <td bgcolor="#E0D2DF" class="blacktxt">Ad Details </td>
          </tr>
          <tr>
            <td><table width="70%"  border="0" cellspacing="0" cellpadding="0">
              <tr class="leftlinks">
                <td width="30%">Ad Id </td>
                <td width="70%"><?=$qr['siteid']?></td>
              </tr>
              <tr class="leftlinks">
                <td>Ad Views </td>
                <td><?=$sitehits?></td>
              </tr>
              <tr class="leftlinks">
                <td>Ad Expires </td>
                <td class="blacktxt">
                  <? 
				$expire_days = $qr['expire_days'];
				echo $prev_date = date("d.m.Y",strtotime ("+$expire_days day",mktime(0,0,0,substr($qr['sitedate'],3,2),substr($qr['sitedate'],0,2),substr($qr['sitedate'],6,4))));
			?>
                </td>
              </tr>
              <tr class="leftlinks">
                <td>Added</td>
                <td><?=$qr['sitedate']?></td>
              </tr>
              <tr class="leftlinks">
                <td>Country</td>
                <td><?=$qr['country']?></td>
              </tr>
              <tr class="leftlinks">
                <td>State</td>
                <td><?=$qr['state']?></td>
              </tr>
              <tr class="leftlinks">
                <td>City</td>
                <td><?=$qr['city']?></td>
              </tr>
              <tr class="leftlinks">
                <td> </td>
                <td> </td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td> </td>
          </tr>
  <?
  if(isset($_SESSION['session_login'])){
  
  	$sql = "SELECT * FROM favourites WHERE f_adid=".$_GET['sid']." AND femail = '".$_SESSION['session_login']."'";
	$result_fav = mysql_query($sql) or die(mysql_error());
	if(mysql_num_rows($result_fav) == 0){
  
  ?>
          <tr>
            <td class="blacktxt"><a href="ad_favorite.php?sid=<?=$_GET['sid']?>" class="blacktxt"><img src="images/bookmark.gif" width="20" height="20" border="0"> Add to Favorites </a></td>
          </tr>
<?
	}else{

?>
          <tr>
            <td class="blacktxt"><a href="ad_favorite.php?sid=<?=$_GET['sid']?>&id=r" class="blacktxt"><img src="images/bookmark.gif" width="20" height="20" border="0"> Remove from Favorites </a></td>
          </tr>
    <?
	}

}
?>
	  
        </table></td>
        <td width="37%" valign="top"><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="brd">
	<?
		$sql_img = "SELECT * FROM picture WHERE pictures_siteid=".$qr['siteid']." ORDER BY id DESC LIMIT 0,3";
		$row_img = mysql_query($sql_img) or die(mysql_error());
		//$qr_img = mysql_fetch_array($row_img);
		if(mysql_num_rows($row_img) == 0){
	?>
          <tr>
            <td align="center" class="leftlinks"><br><br><br>No Images Available!<br><br><br></td>
          </tr>
          <tr>
            <td height="10"></td>
          </tr>

	<?
		}else{
			while($qr_img = mysql_fetch_array($row_img)){
				if($qr_img['filename'] != "") {
	?>
          <tr>
            <td align="center"><a href="ad_images/<? echo($qr_img['filename']);?>" target="_blank"><img src="ad_images/<? echo($qr_img['filename']);?>" width="100px" border="0"></a></td>
          </tr>
          <tr>
            <td height="10"></td>
          </tr>
	<? 
				}
			}
		}

	?>		  
        </table></td>
      </tr>
      <tr>
        <td colspan="2"> </td>
      </tr>
      <tr>
        <td colspan="2"> </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td> </td>
  </tr>
  <tr>
    <td align="center"><table width="98%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="24%" align="center" valign="top"><a href="search.php?cid=<?=$qr['sitecatid']?>" class="leftlinks"><img src="images/icon_moreadsincat.gif" width="32" height="32" border="0" align="middle"> More ads in this Category</a> </td>
        <td width="24%" align="center"><a href="search.php?sid=<?=$_GET['sid']?>" class="leftlinks"><img src="images/icon_adsfromseller.gif" width="32" height="32" border="0" align="middle"> Ads from this seller</a> </td>
        <td width="27%" align="center"><a href="contact_seller.php?sid=<?=$_GET['sid']?>" class="leftlinks"><img src="images/icon_contactsalesperson.gif" width="32" height="32" border="0" align="middle"> Contact Seller</a></td>
        <td width="25%" align="center"><a href="tell_friend.php?sid=<?=$_GET['sid']?>" class="leftlinks"><img src="images/icon_tellafriend.gif" width="32" height="32" border="0" align="middle"> Tell a Friend</a> </td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td> </td>
  </tr>
  <tr>
    <td bgcolor="#E0D2DF"><? require("include/footer.php");?></td>
  </tr>
</table>
</body>
</html>

Link to comment
Share on other sites

Notice: Undefined variable: new_hits in /home/content/g/m/d/gmdistributors/html/post/detail.php on line 9

 

This seems to be telling you that $new_hits has not been defined as of that line. Since your using it in your sql statement, then it should have been defined by this point. I bet if you echo your $sql variable, you will find that the $new_hits var is not set with anything.

 

Warning: mysql_fetch_array():.......

 

This is because this..

$qr = mysql_fetch_array($row);

 

did not actually return anything. Your query is an update query, not a select query. The only thing you can "return" from the update query is

if(mysql_affected_rows() > 0)
{
  echo 'Successfully updated table';
}

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=

 

I think if you clean up the other 2 items this one will probably clear up.

 

Notice: Undefined index: siteid in /home/content/g/m/d/gmdist' at line 1

 

This is telling you that you have not defined $siteid yet. I generally ignore these because they are really easy to get.

<?php

$x = '234';

?>

 

This will more than likely generate a NOTICE error. I generally do this for error reporting.

 

error_reporting(E_ALL ^ E_NOTICE);

 

Ignoring those are not the best solution, as all errors/notices should be dealt with properly, but NOTICES about undefined indexes are annoying and I choose to ignore them rather than have an empty var initialization in my code.

 

Nate

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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