php problem...

  • Thread starter Thread starter AndyBlack
  • Start date Start date
A

AndyBlack

Hi,

Just wondered if any of you php wizards would take a look at the following code for me. It is coming back with an error. Can I have a while loop within an isset {} statement?

The error i'm getting is..........

Parse error: syntax error, unexpected '{' in /home/awp/public_html/process-categories.php on line 62

The full php segment is......

<?php
# View content script
if (isset($_POST['view'])) {
include 'config.php';
$category = $_POST['contentdata'];
$memberid = $_POST['loggedid'];
$projcat = $_POST['thesite'];
echo "<p class='greentitle'>Content For Topic : ".$category."</p>";
echo "<table width='506' height='56' border='0' align='center'>";
$query = mysql_query("SELECT * FROM content WHERE category LIKE '".$category."' AND memberid LIKE '".$memberid."'");
while ($row = (mysql_fetch_array($query)) {
$content = $row['content'];
$theid = $row['id'];
echo "<tr>";
echo "<td width='372'><label>";
echo "<textarea name='contentdata' cols='45' rows='7' value='".$content."'></textarea>";
echo "</label></td>";
echo "<td width='64'><input type='submit' name='update' value='Update!!' /></td>";
echo "<td width='56'><label>";
echo "<input type='submit' name='delete' value='Delete!' />";
echo "</label></td>";
echo "</tr>"; }
echo "</table>"; }
?>

The red text is line 61.

If any of you guys can advise me on this, it would be much appreciated.

Thanks!

Andy :)
 
Or, of course, take off the ( before mysql_fetch_array - that'll work too!
 
Upvote 0
Thanks!! Couldn't see for looking. :) :rolleyes:

Andy
 
Last edited by a moderator:
Upvote 0
No worries - that comes filed under "Welcome to my world" :) - and you should try it when (as with one site I'm working on at the moment) the host has got all error reporting turned off, so you just see a blank page instead of what you expected.

Seriously farking unhelpful...
 
Last edited by a moderator:
Upvote 0
No worries - that comes filed under "Welcome to my world" :) - and you should try it when (as with one site I'm working on at the moment) the host has got all error reporting turned off, so you just see a blank page instead of what you expected.

Seriously farking unhelpful...

ini_set('display_errors', '1');
 
Upvote 0
yep, and ini_set(error_reporting,"E_ALL")

Neither of which work, for reasons unknown to me.

*shrug* I just end up developing on my own server, then copying it over when it all works.
 
Upvote 0
Problem with own server is that it's never exactly the same as the production server unless you control both.

We've discovered slight parsing issues with regex in php 5.1.6 that don't exist in any other version, BOM problems on ZEUS servers, and so on. Can be really painful to debug on some shared hosting - to the point that we're starting to run away screaming from any significant work that's expected to run on shared machines.
 
Upvote 0
Oh yes, that's bitten me on the arse a couple of times ( 1and1, I'm looking at you here in particular ) but I find it depends on the client.

Sometimes we'll move the site over to my own hosting provider, but sometimes they'll want to stick with their own one. At that point I always put in a proviso that until I've sussed what the server is like, costs aren't definite one way or another.

Equally, if we set up a dev area on their server, I can put bits into it once I know they work on mine, and test as I go just to check things are OK on the other server too.
 
Upvote 0

Latest Articles