Jump to content

bravo14

Members
  • Posts

    296
  • Joined

  • Last visited

Everything posted by bravo14

  1. Think I may have solved it, won't know until later.
  2. Thanks for all your help guys, still geting error message Parse error: syntax error, unexpected '[' in /home/fhlinux147/y/yardleyheroes.co.uk/user/htdocs/fixtures.php on line 58 $result = mysql_query('SELECT * FROM `fixtures` ORDER BY `date`', $con) or die(mysql_error()); if(mysql_num_rows($result) < 1) { echo('<tr class="profiletext"><td colspan="7">Sorry, no results were found.</td></tr>'); } else { while($row = mysql_fetch_array($result)) { if ($row.[HomeAway].=="Home") { echo ('<tr><td>'.$row[Date].'</td><td><b>Yardley</b></td>'); echo ('<td>'.$row[yardley_goals].'-'.$row[opposition_goals].'</td><td>'.$row[Opposition].'</td>'); echo ('<td></td><td><a href="http://www.yardleyheroes.co.uk/matchfines.php?match_id='.$row[match_id].'"View Fines</a></td></tr>'); } else{ echo ('<tr><td>'.$row[Date].'</td><td>'.$row[Opposition].'</td>'); echo ('<td>'.$row[opposition_goals].'-'.$row[yardley_goals].'</td><td>Yardley</td>'); echo ('<td></td><td><a href="http://www.yardleyheroes.co.uk/matchfines.php?'.$row[match_id].'<a></td></tr>'); } } } mysql_close($con); ?> Line 58 is if ($row.[HomeAway].=="Home") {
  3. Sorry guys being a bit thick where do I need to put the { at the moment I have done it as follows if {($row[Home/Away]=="Home") and I am getting an error message Sorry about this
  4. Thank you for your quick response I have copied that text over so it now looks like $result = mysql_query('SELECT FROM fixtures ORDER BY date', $con) or die(mysql_error()); if(mysql_num_rows($result) < 1) { echo('<tr class="profiletext"><td colspan="6">Sorry, no results were found.</td></tr>'); } else { while($row = mysql_fetch_array($result)) { if ($row[Home/Away]=="Home") echo ('<tr><td>'.$row[Date].'</td><td><b>Yardley</b></td>'); echo ('<td>'.$row[yardley_goals].'-'.$row[opposition_goals].'</td><td>'.$row[Opposition].'</td>'); echo ('<td></td><td><a href="http://www.yardleyheroes.co.uk/matchfines.php?match_id='.$row[match_id].'"View Fines</a></td></tr>'); } else{ echo ('<tr><td>'.$row[Date].'</td><td>'.$row[Opposition]'</td>'); echo ('<td>'.$row[opposition_goals].'-'.$row[yardley_goals].'</td><td>Yardley</td>'); echo ('<td></td><td><a href="http://www.yardleyheroes.co.uk/matchfines.php?').$row[match_id].'<a></td></tr>'); } } } mysql_close($con); ?> and get the following error message Parse error: syntax error, unexpected T_ELSE in /home/fhlinux147/y/yardleyheroes.co.uk/user/htdocs/fixtures.php on line 64 Line 64 is else{ Any ideas? Cheers Mark
  5. Hi all I am trying to display a list of fixtures using if statements. If the Home/Away field is Home I want it to display the fixtures in one way and if it is Away I want it to show another way, I have had a stab at it but am getting an error message on the page at www.yardleyheroes.co.uk/fixtures.php $result = mysql_query('SELECT FROM fixtures ORDER BY date', $con) or die(mysql_error()); if(mysql_num_rows($result) < 1) { echo('<tr class="profiletext"><td colspan="6">Sorry, no results were found.</td></tr>'); } else { while($row = mysql_fetch_array($result)) { if ($row[Home/Away]=="Home") echo ('<tr><td>'.$row[Date].'</td><td><b>Yardley</b></td>'); echo ('<td>'.$row[yardley_goals].'-'.$row[opposition_goals].'</td><td>'.$row[Opposition].'</td>'); echo ('<td></td><td><a href="http://www.yardleyheroes.co.uk/matchfines.php?match_id='.$row[match_id].'"View Fines</a></td></tr>'); else{ echo ('<tr><td>'.$row[Date].'</td><td>'.$row[Opposition]'</td>'); echo ('<td>'.$row[opposition_goals].'-'.$row[yardley_goals].'</td><td>Yardley</td>'); echo ('<td></td><td><a href="http://www.yardleyheroes.co.uk/matchfines.php?').$row[match_id].'<a></td></tr>'); } } mysql_close($con); ?> Cheers Mark
  6. In addition to the previous post db is cyb Username is cybadmin
  7. Hello I am trying to grant permissions on another database and used the template as laid out above GRANT ALL permissions ON 'cyb@server213-171-219-90.livedns.org.uk' TO 'cybadmin.*'; and get the following error message #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 'permissions ON 'cyb@server213-171-219-90.livedns.org.uk'TO 'cybadmin.*'' at line 1 MySQL client version: 5.0.22 does anybody have guidance
  8. Thanks guys for your responses, it is a script I found from somewhere else, I am going to try and create a login using session, but this will be a first, so it will be interesting to see what I can come up with, does anyone have a starting point for me?
  9. Thanks for your help guys. Craygo just out of curiosity as I am relatively new to PHP/MySQL where in the code below would I put the code you suggested? $result = mysql_query('SELECT * FROM `reports` ORDER by report_id LIMIT 0, 30 ', $con); while($row = mysql_fetch_array($result)) { echo ('<tr class="profiletext"><td>'.$row[date].'</td>');
  10. Hi all I have a forum on my site however as the users do not have to log in, I am having a lot of messages on there that I do not want. I want to try and create a registration process and log in script for registered users if they want to add a post to the forum. Does anybody have any ideas or sources? Thanks again Mark
  11. Hi All I have some dates in a mysql database and it is the format of yyyy-mm-dd and I wanto to display it in a differnet format on the web pages. Any assistance would be much appreciated. Mark
  12. Hi all I have probable made a very simple error hopefully someone can help I am trying to insert a record into a database using PHP the form is built using the following code <?php echo ('<form action="insert_fine.php"><table width="65%" border="0">'); echo ('<tr>'); echo ('<td width="30%" class="profiletext">Name</td>'); echo ('<td><select name="name">'); $con = mysql_connect('IPaddress', 'database', 'password', true); if(!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db('yardleyheroes', $con); $res=mysql_query('SELECT * FROM `profiles` WHERE `profiletype` =\'player\'ORDER BY `name`'); if(mysql_num_rows($res)==0) echo('<option>there is no data in table..</option>'); else { while($row=mysql_fetch_assoc($res)) { echo('<option value='.$row[profile_id].'>'.$row[name].'</option>'); } } echo ('</select></td>'); echo ('</tr>'); echo ('<tr>'); echo ('<td class="profiletext">Game</td><td><select name="match" width="145">'); $fixtures=mysql_query('SELECT * FROM `fixtures` ORDER BY `date`'); if(mysql_num_rows($fixtures)==0) echo('<option>there is no data in table..</option>'); else { while($matchrow=mysql_fetch_assoc($fixtures)) { echo('<option value='.$matchrow[match_id].'>'.$matchrow.'|'.$matchrow[Opposition].'</option>'); } } echo ('</select></td></tr>'); echo ('<tr>'); echo ('<td class="profiletext">Amount</td>'); echo ('<td><input type="text" name="amount"></td>'); echo ('</tr>'); echo ('<tr>'); echo ('<td class="profiletext">Reason</td>'); echo ('<td><textarea name="reason" cols="50" rows="4"></textarea></td>'); echo ('</tr>'); echo ('<tr>'); echo ('<td> </td>'); echo ('<td><input type="submit" name="Submit" value="Submit"></td>'); echo ('</tr>'); echo ('</table>'); echo('</form>'); ?> And the process code is <?php $con = mysql_connect('IPaddress', 'username', 'password', true); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db('yardleyheroes', $con);$sql="INSERT INTO fines (profile_id, fine_amount, reason) VALUES ('$_POST[name]','$_POST[amount]','$_POST[reason]')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo ('1 record added'); echo ('<table><tr><td>Name</td><td>Amount</td><td>Reason</td></tr>'); echo ('<tr><td>'.$_POST[name].'</td><td>'.$_POST[amount].'</td><td>'.$_POST[reason].'</td></tr></table>'); mysql_close($con) ?> When processing the Insert, the code says that the record has been produced, but the data from the form does not get created. Thanks in advance
  13. The error message I am getting here is #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 'permissions to 'yardleyheroes.*' on 'yardleyheroes@server213-171-218-147.livedns' at line 1
  14. I am trying to grant permission to a user on a mysql database GRANT ALL permissions TO 'yardleyheroes.*' ON 'yardleyheroes@server213-171-218-147.livedns.org.uk' Can anybody give me any guidance
  15. Hi folks Newbie to this forum, but hoping there is someone there who can help I am trying to display the results of a MySQL query on a page using PHP, the query works in phpmyadmin see code below <?php $con = mysql_connect('213.171.219.88', 'yardleyheroes', 'heroes', true); if(!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db('yardleyheroes', $con); $result = mysql_query('SELECT Sum(fines.fine_amount) AS SumOffine_amount, profiles.name FROM fines INNER JOIN profiles ON fines.profile_id = profiles.profile_id GROUP BY profiles.name ORDER BY Sum(fines.fine_amount); LIMIT 0, 30 ', $con); if(mysql_num_rows($result) < 1) { echo('<tr><td colspan="2">Sorry, no results were found.</td></tr>'); } else { while($row = mysql_fetch_array($result)) { echo('<tr><td valign="top">' . $row['name'] . '</td>'); echo('<td> £' . $row['SumOffine_amount'] .'.00</td></tr>'); } } mysql_close($con); ?> I get the following message on the page Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/fhlinux147/y/yardleyheroes.co.uk/user/htdocs/fines.php on line 52 Line 52 is if(mysql_num_rows($result) < 1) Any ideas, the page can be seen at www.yardleyheroes.co.uk/fines.php
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.