Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9081351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:17:40+00:00 2026-06-16T20:17:40+00:00

I seem to be having a rough time with this snippet of code, Which

  • 0

I seem to be having a rough time with this snippet of code, Which i dont understand because on my home server this works 100% perfect. basically this script takes the users ip and stores it into a mysql table. every time a user posts it checks the table to see if the ip has already posted. when i run mysql_error() on num_rows which apears to be the problem, i get:

Parse error: syntax error, unexpected T_LOGICAL_OR on line 119

Any ideas?

php:

$poster_ip=$_SERVER['REMOTE_ADDR'];//Posters ip
//check for ip double posting
//selecet ip from table
$sql="SELECT * FROM $tbl_name WHERE ip='$poster_ip'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
or die mysql_error();//line 119
//if result matche posterip, table row must be 1
if($count==1){
//ip taken
echo "This IP has already submited a post. You may not submit another.";
exit();
//else script continues
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:17:41+00:00Added an answer on June 16, 2026 at 8:17 pm

    Remove the semicolon because that terminates the statement and the or die is treated as a new statement, causing the error:

    $count=mysql_num_rows($result) or die(mysql_error());
                             //   ^ no semicolon
    

    You also need parenthesis around the die() call.

    Side note: or die(mysql_error()) is not considered good practice because it’s difficult to maintain between development and production environments. or trigger_error(mysql_error()) would be better – this writes to your error log. Also consider upgrading to PDO or MySQLi because this MySQL library is deprecated and discouraged.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I seem to be having a device specific problem with this code below, as
I seem to be having trouble with my code. I need to say: if
I seem to be having a very frustrating time with an inherited class calling
I seem to be having a problem with my footer growing to 100% width
I seem to be having trouble reading preferences from my AppWidgetProvider class. My code
I seem to be having some trouble with 100% widths. I have 3 divs,
I seem to be having a problem with Entity Framework code-first. I managed to
I'm having a rough time here with Resque, firstly, in development when running rake
I seem to be having an odd issue whereby every time I try to
I seem to be having a problem with long polling and IE. This is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.