SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    the highest ID ?!?!

    where is the worng here, i wanna to write the highest ID !

    PHP Code:

    if($action == "add" && $addsite == "1"){
     #$news = br($news);
     if(ereg("^.+@.+\\..+$", $email) AND $name != "" AND $news != "" AND $title != ""){
        $query = "INSERT INTO $table (ID, title, date, poster, email, news, readmore, link, act, filename) VALUES ('', '$title', '$date', '$name', '$email', '$news', '$readmore', '$link', '$act', '$filename')";

                mysql_query($query, $db);


                echo"<center>News has been submitted$b</center>";
       #########################

    $en_file = fopen("../data.php", "r");

    $query = "SELECT * FROM news ORDER BY ID DESC LIMIT 1";
    $ha = mysql_query(query,$db);//$ha[id] will return the highest ID in $nana

    $nana = " $~action=$act; $~ID=$ha[ID]; include(\"$filename\"); ";
    $ads ="<? " .eregi_replace("~", "", "$nana"). " ?>";


        $ads .= fread($en_file, filesize("../data.php"));
        fclose($en_file);

        $en_file = fopen("../data.php", "w");
        fwrite($en_file, $ads);
        fclose($en_file);

  2. #2
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i found it
    it must be : $ha = mysql_fetch_array($query);



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •