Need PHP code for updating Table

Discussion in 'PHP' started by surfnearnzone, Jul 15, 2007.

  1. #1
    Can you help me with this. My knowledge with PHP and SQL is very limited. I am still learning it.

    All I want to do is to populate a SQL table with pre-written data. For example a list of image names and thier description or location to be inserted in the table. Also how can I list the contents of the database table.

    This is very easy in ASP but I need to do it in PHP. Please help.

    Cheers :)
     
    surfnearnzone, Jul 15, 2007 IP
  2. fablex

    fablex Peon

    Messages:
    468
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    to enter data in a mysql database with php:

    mysql_query("INSERT INTO tablename SET columnname = 'value' AND secondcolumn = 'value'", $dbh);

    $dbh is the variable I use for the database connection in this case. Dont know if this is the best code, but I always do it like this.

    Hope it helped.
     
    fablex, Jul 15, 2007 IP
    surfnearnzone likes this.
  3. surfnearnzone

    surfnearnzone Well-Known Member

    Messages:
    1,492
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    165
    #3
    I will try this. But I am not sure if this will do the work. I want to make an application something like file uploader of yahoo brief case.

    What I want to do is that upload images in a batch mode on my server and then update the SQL table with image name, location, description, Size.

    I also want a method to view this data through PHP code. I mean the images. The script will pull out images using the location attrb. and display name, description and size of the images.

    To do this in asp is easy. I just need to use the insert statement and then use response.write ("<img source=""" & rs.field.item(img_loc).value & ">"). I can then create a loop to display required number of images on a single page.

    Please advise how to do this in PHP.



     
    surfnearnzone, Jul 15, 2007 IP