Jump to content

Search the Community

Showing results for tags 'mysql php database simple'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi, Here's the source code: <?php error_reporting(-1); //defines the database information needed in order to link to the database define ('DB_NAME', 'questions'); define ('DB_USER', 'root'); define ('DB_PASSWORD', ''); define ('DB_HOST', 'localhost'); //the actual link between PHP and MySQL below $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); //error just incase it doesn't work so I can tell what's wrong if (!$link) { die('Could not connect: ' . mysql_error()); } //This selects the database I want to use and links it via msq_connect $db_selected = mysql_select_db(DB_NAME, $link); //incase of an error if (!$db_selected) { die('Can\'t use ' . DB_NAME . ':'.mysql_error()); } $query = "SELECT * FROM `questions_user` ORDER BY id DESC"; $result = mysql_query($query); if (!mysql_query($value)) { die('Cannot obtain $query!' . mysql_error()); } if (mysql_num_rows == 0) { echo 'There are no queries at this time!'; die; } while($data = mysql_fetch_row($result)){ echo $data; } mysql_close(); ?> When I load the page I get a "query was empty" error. The DB name is questions The DB table is questions_user The DB fields are `ID` and `questions_field` This is some of the first interactive things i've made combining mysql and php. I know the code is probably sloppy. Thanks for helping me out, Fisher P.S. I'm trying to output the data from 'questions_user' to just a random spot on a webpage.
×
×
  • 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.