<?php $con = mysql_connect("server.com","user","pswd"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("db", $con); $result = mysql_query("select count(1) FROM table"); $row = mysql_fetch_array($result); $total = $row[0]; echo "Total rows: " . $total; mysql_close($con); ?>
Related Posts:
- How to use mysqli_query() in PHP?
- PHP Connection failed: SQLSTATE[HY000] [2002] Connection refused
- PHP Connection failed: SQLSTATE[HY000] [2002] Connection refused
- PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP
- what does “/index.php?admin/admin_dashboard” in my url mean
- How can I prevent SQL injection in PHP?
- How to create a foreign key in phpmyadmin
- If variable equals value php [duplicate]
- PHP date() format when inserting into datetime in MySQL
- PHP Warning: mysqli_error(): Couldn’t fetch mysqli in
- Foreach only outputs if id is 0
- Fatal error: Call to undefined function mysql_connect()
- mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in
- Not unique table/alias
- Install mysql-python (Windows)
- Disable ONLY_FULL_GROUP_BY
- MySQL WHERE IN ()
- How can I do ‘insert if not exists’ in MySQL?
- MySQL Error #1133 – Can’t find any matching row in the user table
- How can I do ‘insert if not exists’ in MySQL?
- Best way to store an array in MySQL database?
- How to check if mysql database exists
- #1062 – Duplicate entry for key ‘PRIMARY’
- Warning: session_start(): Cannot send session cookie – headers already sent by (output started at [duplicate]
- How can I convert a string to a float in mysql?
- Is there a Profiler equivalent for MySql?
- How to use greater than operator with date?
- How to make DROP INDEX IF EXISTS for mysql?
- How get value from URL
- Data is not constantly loading from custom wordpress table
- How to cache/speed WordPress queries for logged in users?
- How to run WordPress across 2 VMs for high availability
- How to disable `SQL_CALC_FOUND_ROWS` [duplicate]
- “#1067 – Invalid default value for ‘post_date'” when trying to reset AI after backup
- Custom SQL query to get List of posts with featured image url
- Delete post revisions on post publish
- Problems migrating WordPress to localhost
- error importing localhost export file to server
- WordPress Deadlock Error
- How to do a MySQL dump from production site without using a search and replace script for local development?
- How to bulk edit canonical url’s in SQL?
- Concurrent / simultaneous MySQL connections
- How to check for empty and not a failure
- How many ‘wp_insert_post’ calls can be performed in one shot, in a very long ‘for’ loop?
- How to write one comment and publish on every post using database or plugin?
- Setting All Drafts to ‘exclude-from-catalog’ in WooCommerce
- Can’t find my wordpress DB in phpmyadmin
- Deprecated: mysql_connect():
- How to simultaneously access the same MySQL database in the main column and sidebar of WordPress?
- WordPress php mysql errors – errcode: 13 permission denied
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- $wpdb select all meta for each post
- Calculate average crossing post categories
- Replacing link URL ending strings via MySQL
- SQL command to convert all tags in lowercase?
- Problem with admin login after deployment
- Find out how many times the user has logged in
- Is it possible to create a WordPress table using array and loop?
- How to stop $wpdb from prepending database name
- Should I use WordPress to skin a database website?
- WordPress Custom SQL Table with UserID Filter for results
- How can I add a new row in a separate database when someone registers via WordPress?
- How to use mysql LIKE with wpdb?
- Best approach for a custom database filling in WP custom post types
- speed up pagination for huge database
- How to use AJAX in WordPress in MYSQL query?
- Processing ajax call to php to insert into mysql database
- WordPress Custom Query: Combining Two Functions
- SQL statement using placeholder is not returning results
- Passing in MySQL prepare statement parameter separately throwing error
- Database SQL query error
- How to Bulk find and replace MySQL for post image url
- MYSQL TIMESTAMP when adding DATE_FORMAT then the output is blank, PHP conflict?
- Updated Php version from 5.4 to 7.2 and getting “PHP installation missing the MySQL extension needed by WordPress”
- How to optimize and reduce excessive database queries
- Store GA Client ID in User DB
- update multiple rows in mysqli table base on two values
- PHP 7.2.18 | Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- Need help with format of nested array in MySQL
- How can I verify WordPress nonce from the following code?
- How to write in MySQL more characters in user_nicename
- Inserting other fields to existing registration form in a WordPress theme
- Splitting table data to pages with numbers
- Site doesnt work once PHP changed to 7.1
- WordPress WPDB::insert 13th param is always blank (only if format)
- Ajax not updating to database
- can’t delete a row from post_meta table
- MySQL query in WordPress with AJAX
- What is the cron doing?
- SQL error on restoring database
- MySQL database gives blank page (white screen of death)
- retrieve wordpress post-meta using php not wordpress functions
- Splash pages on a high traffic site
- why is $wpdb->update() causing a DB error from within wp_set_password()
- Global MySQL replacing of text patterns/matches
- how to search through plugin in wordpress cimy-user-extra-fields?
- InnoDB: Error: log file ./ib_logfile0 is of different size
- Postgres equivalent to MySQL’s \G?
- Putting form result in my database
- How can I update a value of a field depending on outside source?