I am new to PHP and trying to get the following code to work:
<?php include 'config.php'; include 'opendb.php'; $query = 'SELECT name, subject, message FROM contact'; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo 'Name :{$row['name']} <br>' . 'Subject : {$row['subject']} <br>' . 'Message : {$row['message']} <br><br>'; 'ARTICLE_NO :{$row['ARTICLE_NO']} <br>' . 'ARTICLE_NAME :{$row['ARTICLE_NAME']} <br>' . 'SUBTITLE :{$row['SUBTITLE']} <br>' . 'CURRENT_BID :{$row['CURRENT_BID']} <br>' . 'START_PRICE :{$row['START_PRICE']} <br>' . 'BID_COUNT :{$row['BID_COUNT']} <br>' . 'QUANT_TOTAL :{$row['QUANT_TOTAL']} <br>' . 'QUANT_SOLD :{$row['QUANT_SOLD']} <br>' . 'STARTS :{$row['STARTS']} <br>' . 'ENDS :{$row['ENDS']} <br>' . 'ORIGIN_END :{$row['ORIGIN_END']} <br>' . 'SELLER_ID :{$row['SELLER_ID']} <br>' . 'BEST_BIDDER_ID :{$row['BEST_BIDDER_ID']} <br>' . 'FINISHED :{$row['FINISHED']} <br>' . 'WATCH :{$row['WATCH']} <br>' . 'BUYITNOW_PRICE :{$row['BUYITNOW_PRICE']} <br>' . 'PIC_URL :{$row['PIC_URL']} <br>' . 'PRIVATE_AUCTION :{$row['PRIVATE_AUCTION']} <br>' . 'AUCTION_TYPE :{$row['AUCTION_TYPE']} <br>' . 'INSERT_DATE :{$row['INSERT_DATE']} <br>' . 'UPDATE_DATE :{$row['UPDATE_DATE']} <br>' . 'CAT_1_ID :{$row['CAT_1_ID']} <br>' . 'CAT_2_ID :{$row['CAT_2_ID']} <br>' . 'ARTICLE_DESC :{$row['ARTICLE_DESC']} <br>' . 'DESC_TEXTONLY :{$row['DESC_TEXTONLY']} <br>' . 'COUNTRYCODE :{$row['COUNTRYCODE']} <br>' . 'LOCATION :{$row['LOCATION']} <br>' . 'CONDITIONS :{$row['CONDITIONS']} <br>' . 'REVISED :{$row['REVISED']} <br>' . 'PAYPAL_ACCEPT :{$row['PAYPAL_ACCEPT']} <br>' . 'PRE_TERMINATED :{$row['PRE_TERMINATED']} <br>' . 'SHIPPING_TO :{$row['SHIPPING_TO']} <br>' . 'FEE_INSERTION :{$row['FEE_INSERTION']} <br>' . 'FEE_FINAL :{$row['FEE_FINAL']} <br>' . 'FEE_LISTING :{$row['FEE_LISTING']} <br>' . 'PIC_XXL :{$row['PIC_XXL']} <br>' . 'PIC_DIASHOW :{$row['PIC_DIASHOW']} <br>' . 'PIC_COUNT :{$row['PIC_COUNT']} <br>' . 'ITEM_SITE_ID :{$row['ITEM_SITE_ID']}; } include 'closedb.php'; ?>
However I get this error:
Parse error: syntax error, unexpected $end in C:\Programme\EasyPHP 2.0b1\www\test.php on line 56
I would also like to know if there is perhaps an easier way to obtain mysql records instead of typing by hand?
edit:
I fixed the semicolon and quote issue, and now get:
Parse error: syntax error, unexpected T_STRING in C:\Programme\EasyPHP 2.0b1\www\test.php on line 51
I am sorry I don’t know how to make colors in the code.
Edit
You say that you’re still getting an error. Did you remember to add a . when you removed that extra semi-colon?
You have a semi-colon in the middle of your string, two lines after the echo.
Also, the end of the string is missing a double-quote.
As far as a cleaner way to output all the values goes, you can loop over the result array like this: