The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 4 of 4

Thread: php syntax error

  1. #1

    php syntax error

    Hi,
    I'm trying to do this tutorial to do a blog in flash. http://www.webmonkey.com/webmonkey/0...tw=programming

    When I get to the php section It's not working. I'm trying to import the php file with phpmyadmin and I keep getting an error.

    #1064 - 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 '<?php
    mysql_pconnect ("yourHost", "yourUserName", "yourPassword")' at line 1

    My code is:

    <?php
    mysql_pconnect ("yourHost", "yourUserName", "yourPassword");

    mysql_select_db ("blog_db");
    $qResult = mysql_query ("SELECT * FROM blog_entries ORDER BY id DESC");

    $nRows = mysql_num_rows($qResult);
    $rString ="&n=".$nRows;


    for ($i=0; $i< $nRows; $i++){
    $row = mysql_fetch_array($qResult);
    $rString .="&id".$i."=".$row['id']."&"."&title".$i."=".$row['title']."&"."&date".$i."=".$row['date']."&"."&entry".$i."=".$row['entry']."&";
    }
    echo $rString."&";

    ?>


    Obviously I didn't put my username and password on here :-P.
    Anyway, I've never used databases or php before but I was using this tutorial to learn but this part isn't working. I read that someone else tried doing the same tutorial and they went from text edit on mac to puretext and it fixed it. I have a mac so I don't think I can use pure edit. I tried something called text mate and that's not working either. If anyone could help me i'd really appreciate it. I'm really trying to learn this stuff and a lot of the books on it are really complicated. This tutorial was good until this part.

    Holly

    Thank you ahead of time.

  2. #2
    That script doesn't need to be imported into phpMyAdmin, that is the script which GETS the data from MySQL. I think it means you can just use phpMyAdmin to enter data

  3. #3

    thank you

    Thank you very much for replying. I guess I don't need to import that into phpmyadmin. I got help from someone at bluehost and they weren't helpful at all. Everyone has been helpful except one guy that I seem to keep getting when I call. I just wanted to upload that to the server and check the url to see if my php was working. The guy told me to use phpmyadmin. Confusion!!


    Holly

  4. #4
    [QUOTE=hollyolly84;2280520]Thank you very much for replying. I guess I don't need to import that into phpmyadmin. I got help from someone at bluehost and they weren't helpful at all. Everyone has been helpful except one guy that I seem to keep getting when I call. I just wanted to upload that to the server and check the url to see if my php was working. The guy told me to use phpmyadmin. Confusion!!


    I think I figured it out..somewhat. I just uploaded the php file to my server using fetch. I see this

    &n=21&id0=21&&title0=&&date0=0000-00-00 00:00:00&&entry0=&&id1=20&&title1=&&date1=0000-00-00 00:00:00&&entry1=&&id2=19&&title2=&&date2=0000-00-00 00:00:00&&entry2=&&id3=18&&title3=&&date3=0000-00-00 00:00:00&&entry3=&&id4=17&&title4=&&date4=0000-00-00 00:00:00&&entry4=&&id5=16&&title5=&&date5=0000-00-00 00:00:00&&entry5=&&id6=15&&title6= $i++){&&date6=0000-00-00 00:00:00&&entry6=&&id7=14&&title7=&&date7=0000-00-00 00:00:00&&entry7=&&id8=13&&title8=&&date8=0000-00-00 00:00:00&&entry8=&&id9=12&&title9=&&date9=0000-00-00 00:00:00&&entry9=&&id10=11&&title10=&&date10=0000-00-00 00:00:00&&entry10=&&id11=10&&title11=&&date11=0000-00-00 00:00:00&&entry11=&&id12=9&&title12=&&date12=0000-00-00 00:00:00&&entry12=&&id13=8&&title13=&&date13=0000-00-00 00:00:00&&entry13=&&id14=7&&title14=&&date14=0000-00-00 00:00:00&&entry14=&&id15=6&&title15=&&date15=0000-00-00 00:00:00&&entry15=&&id16=5&&title16=&&date16=0000-00-00 00:00:00&&entry16=&&id17=4&&title17=&&date17=0000-00-00 00:00:00&&entry17=&&id18=3&&title18=my third blog entry&&date18=2008-02-01 20:54:42&&entry18=my text here&&id19=2&&title19=my second blog entry&&date19=2008-02-01 20:51:12&&entry19=my text here&&id20=1&&title20=my first blog entry&&date20=2008-02-01 20:48:48&&entry20=your text here&

    Is this what I should be seeing? I'm not sure why there are like 18 entries. I'm pretty sure I did like 3.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012