Announcement

Collapse
No announcement yet.

have a problem with php code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Flyer
    replied
    just learning..

    Leave a comment:


  • Mark Hensler
    replied
    Why are you playing with that if you don't have vB yet?

    Leave a comment:


  • Flyer
    started a topic have a problem with php code

    have a problem with php code

    hello,
    i found this code someplace in this forum:
    Code:
    <?php
    
    require("/full/path/to/admin/config.php");
    $db=mysql_connect($servername,$dbusername,$dbpassword);
    mysql_select_db($dbname);
    $query = "select * from post ORDER BY postid ASC;";
    $resultlatest = mysql_query($query,$db);
    $deadsmilies=mysql_num_rows($resultlatest);
    	function changedomain($htmlcode) {
    	$htmlcode=str_replace("http://www.olddomain.com","http://www.newdomain.com",$htmlcode);
    return $htmlcode;
    }
    
    while ($latest_array = mysql_fetch_array($resultlatest)) {
    $oldcode=$latest_array[6];
    $strippedcode=stripslashes($oldcode);
    $newcode=changedomain($strippedcode);
    $insertcode=addslashes($newcode);
    $postid=$latest_array[0];
    
    mysql_query("UPDATE post SET pagetext='$insertcode' WHERE postid='$postid'", $db);
    echo "Post $postid complete....<br>\n";
    flush();
    
    }
    
    print "DONE!";
    ?>
    but when i run it i have this problem:

    Warning: MySQL: Unable to save result set in /home/test/test.php on line 7

    Warning: Supplied argument is not a valid MySQL result resource in /home/test/test.php on line 8

    Warning: Supplied argument is not a valid MySQL result resource in /home/test/test.php on line 14


    i'm new to php,,, any help??

    thanx

Related Topics

Collapse

Working...
X