PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun Sep 27, 2020 8:26 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Jun 29, 2015 3:48 am 
Offline
Forum Contributor

Joined: Tue Sep 30, 2014 5:27 am
Posts: 420
Hi

next little issue

I have successfully joined two tables together and got the data pulled in from the two tables, now I need to pull data from a third table that contains 3 different dates for different item_id numbers so one is car mot date, second is car insurance date and the third is car tax date

The code I put in profile.php is below

Syntax: [ Download ] [ Hide ]
$sql = "SELECT * FROM users INNER JOIN visitors on visitors.visitor_id = visitors.visitor_id INNER JOIN renewal on visitors.visitor_id = visitors.visitor_id WHERE users.id = $id LIMIT 1";
then bit further below, I have the echo code

echo "<p>Car MOT Expiry Date: {$user['renewal_date']}</p>";
                        echo "<p>Car Insurance Expiry Date: {$user['renewal_date']}</p>";
                        echo "<p>Car TAX Expiry Date: {$user['renewal_date']}</p>";
 


obviously that just outputs the same date on each row

my database structure for the renewal table is below

Syntax: [ Download ] [ Hide ]
-- phpMyAdmin SQL Dump
-- version 4.0.7
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 29, 2015 at 09:46 AM
-- Server version: 5.5.42
-- PHP Version: 5.3.28

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `cl48-taxelepha`
--

-- --------------------------------------------------------

--
-- Table structure for table `renewal`
--

CREATE TABLE IF NOT EXISTS `renewal` (
  `renewal_id` int(11) NOT NULL AUTO_INCREMENT,
  `visitor_id` int(11) NOT NULL,
  `item_id` int(11) NOT NULL,
  `renewal_date` date NOT NULL,
  `date_notified` datetime DEFAULT NULL,
  PRIMARY KEY (`renewal_id`),
  KEY `renewal_id` (`renewal_id`),
  KEY `renewal_id_2` (`renewal_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=181 ;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 4:28 am 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6617
Location: WA, USA
Seems like you should be JOINing in the items table too, and using that to display not just the renewal date but the item - so it's not written in the code like you have now but pulled from the database. What does the table for items (I assume there is one) look like?

Also, you have duplicate keys on the renewal table. A primary key is also an index so the renewal_id and renewal_id_2 indexes are redundant and wasteful.


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 5:17 am 
Offline
Forum Contributor

Joined: Tue Sep 30, 2014 5:27 am
Posts: 420
not sure where the renewal_id_2 is coming from as that is not in the database table structure?

the item table structure is below

Syntax: [ Download ] [ Hide ]
-- phpMyAdmin SQL Dump
-- version 4.0.7
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 29, 2015 at 11:16 AM
-- Server version: 5.5.42
-- PHP Version: 5.3.28

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `cl48-taxelepha`
--

-- --------------------------------------------------------

--
-- Table structure for table `item`
--

CREATE TABLE IF NOT EXISTS `item` (
  `item_id` int(11) NOT NULL,
  `description` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 6:23 am 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6617
Location: WA, USA


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 6:34 am 
Offline
Forum Contributor

Joined: Tue Sep 30, 2014 5:27 am
Posts: 420
Can you check my coding please as got the error MySQL error no 1054 : Unknown column 'v.visitor_firstline' in 'field list'

Syntax: [ Download ] [ Hide ]
$sql = "SELECT u.id, u.username, u.name, v.visitor_firstline, v.visitor_secondline, v.visitor_town, v.visitor_postcode, v.visitor_tel, v.visitor_mobile, v.visitor_model, v.visitor_plate, i.description, r.renewal_date
                FROM renewal r
                JOIN item i ON r.item_id = i.item_id
                JOIN users u ON v.visitors_id = u.id
                WHERE r.renewal_date > NOW()"
;
               
                /*$sql = "SELECT * FROM users INNER JOIN visitors on visitors.visitor_id = visitors.visitor_id INNER JOIN renewal on visitors.visitor_id = visitors.visitor_id WHERE users.id = $id LIMIT 1";*/

                if ($result = $mysqli->query($sql)) {
                        $user = $result->fetch_array();
                } else {
                        echo "<p>MySQL error no {$mysqli->errno} : {$mysqli->error}</p>";
                        exit();
                }
               
                //fetch the data from the database
while ($row = mysqli_fetch_array($query)) {
                               
                if ($result->num_rows == 1) {
                        # calculating online status
                        if (time() - $user['status'] <= (30)) { // 300 seconds = 5 minutes timeout
                                $status = "Online";
                        } else {
                                $status = "Offline";
                        }                      
                       
                        # echo the user profile data
                        echo "<p>User ID: {$user['id']}</p>";
                        echo "<p>Username: {$user['username']}</p>";
                        echo "<p>Name: {$user['name']}</p>";
                        echo "<p>First Line of Address: {$user['visitor_firstline']}</p>";
                        echo "<p>Second Line of Address: {$user['visitor_secondline']}</p>";
                        echo "<p>Town: {$user['visitor_town']}</p>";
                        echo "<p>County: {$user['visitor_county']}</p>";
                        echo "<p>Postcode: {$user['visitor_postcode']}</p>";
                        echo "<p>Telephone Number: {$user['visitor_tel']}</p>";
                        echo "<p>Mobile Number: {$user['visitor_mobile']}</p>";
                        echo "<p>Car Model: {$user['visitor_model']}</p>";
                        echo "<p>Car Number Plate: {$user['visitor_plate']}</p>";
                       
                        echo "<p>{$row['description']} expiry date: {$row['renewal_date']}\n";
                       
                        /*echo "<p>Car MOT Expiry Date:&nbsp;" . date("d/m/Y", strtotime($user ['renewal_date'])) . "</p>";
                        echo "<p>Car Insurance Expiry Date:&nbsp;" . date("d/m/Y", strtotime($user['renewal_date'])) . "</p>";
                        echo "<p>Car TAX Expiry Date:&nbsp;" . date("d/m/Y", strtotime($user['renewal_date'])) . "</p>";*/

                       
                } else { // 0 = invalid user id
                        echo "<p><b>Error:</b> Invalid user ID.</p>";
                }
}

}
 


Once got this sorted, I'll look into the renewal_id_2 but had a quick look and can't see that column so not sure how to delete it from the renewal table?


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 6:45 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada
You don't have a table aliased as v. You're selecting from r, joining u and i. No v.

_________________


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 6:53 am 
Offline
Forum Contributor

Joined: Tue Sep 30, 2014 5:27 am
Posts: 420
I now altered the coding to the following

Syntax: [ Download ] [ Hide ]
$sql = "SELECT u.id, u.username, u.name, visitor_firstline, visitor_secondline, visitor_town, visitor_postcode, visitor_tel, visitor_mobile, visitor_model, visitor_plate, i.description, r.renewal_date
                FROM renewal r
                JOIN item i ON r.item_id = i.item_id
                JOIN users u ON visitor_id = u.id
                JOIN visitors ON id = u.id
                WHERE r.renewal_date > NOW()"
;
 


That is not producing no errors but is displaying no data on the profile.php page

Then I got below

Syntax: [ Download ] [ Hide ]
//fetch the data from the database
while ($row = mysqli_fetch_array($sql)) {
                               
                if ($result->num_rows == 1) {
                        # calculating online status
                        if (time() - $user['status'] <= (30)) { // 300 seconds = 5 minutes timeout
                                $status = "Online";
                        } else {
                                $status = "Offline";
                        }                      
                       
                        # echo the user profile data
                        echo "<p>User ID: {$user['id']}</p>";
                        echo "<p>Username: {$user['username']}</p>";
                        echo "<p>Name: {$user['name']}</p>";
                        echo "<p>First Line of Address: {$user['visitor_firstline']}</p>";
                        echo "<p>Second Line of Address: {$user['visitor_secondline']}</p>";
                        echo "<p>Town: {$user['visitor_town']}</p>";
                        echo "<p>County: {$user['visitor_county']}</p>";
                        echo "<p>Postcode: {$user['visitor_postcode']}</p>";
                        echo "<p>Telephone Number: {$user['visitor_tel']}</p>";
                        echo "<p>Mobile Number: {$user['visitor_mobile']}</p>";
                        echo "<p>Car Model: {$user['visitor_model']}</p>";
                        echo "<p>Car Number Plate: {$user['visitor_plate']}</p>";
                       
                        echo "<p>{$row['description']} expiry date: {$row['renewal_date']}\n";
                       
                        /*echo "<p>Car MOT Expiry Date:&nbsp;" . date("d/m/Y", strtotime($user ['renewal_date'])) . "</p>";
                        echo "<p>Car Insurance Expiry Date:&nbsp;" . date("d/m/Y", strtotime($user['renewal_date'])) . "</p>";
                        echo "<p>Car TAX Expiry Date:&nbsp;" . date("d/m/Y", strtotime($user['renewal_date'])) . "</p>";*/

                       
                } else { // 0 = invalid user id
                        echo "<p><b>Error:</b> Invalid user ID.</p>";
                }
}
 


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 7:29 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada
Looks like you're calling mysqli_fetch_array on the query itself rather than on a result set. Also, I'd recommend specifying the table in your join. ON id = u.id is potentially ambiguous.

_________________


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 7:36 am 
Offline
Forum Contributor

Joined: Tue Sep 30, 2014 5:27 am
Posts: 420
I have tried the following

Syntax: [ Download ] [ Hide ]
<?php
if (logged_in() == false) {
        redirect_to("login.php");
} else {
        if (isset($_GET['id']) && $_GET['id'] != "") {
                $id = $_GET['id'];
        } else {
                $id = $_SESSION['user_id'];
        }
       
        ## connect mysql server
                $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
                # check connection
                if ($mysqli->connect_errno) {
                        echo "<p>MySQL error no {$mysqli->connect_errno} : {$mysqli->connect_error}</p>";
                        exit();
                }
        ## query database
                # fetch data from mysql database
               
                $sql = "SELECT u.id, u.username, u.name, visitor_firstline, visitor_secondline, visitor_town, visitor_postcode, visitor_tel, visitor_mobile, visitor_model, visitor_plate, i.description, r.renewal_date
                FROM renewal r
                JOIN item i ON r.item_id = i.item_id
                JOIN users u ON visitor_id = u.id
                JOIN visitors ON visitor_id = u.id
                WHERE r.renewal_date > NOW()"
;
               
                /*$sql = "SELECT * FROM users INNER JOIN visitors on visitors.visitor_id = visitors.visitor_id INNER JOIN renewal on visitors.visitor_id = visitors.visitor_id WHERE users.id = $id LIMIT 1";*/

                if ($result = $mysqli->query($sql)) {
                        $user = $result->fetch_array();
                } else {
                        echo "<p>MySQL error no {$mysqli->errno} : {$mysqli->error}</p>";
                        exit();
                }
               
                //fetch the data from the database
while ($row = mysqli_fetch_array($result)) {
                               
                if ($result->num_rows == 1) {
                        # calculating online status
                        if (time() - $user['status'] <= (30)) { // 300 seconds = 5 minutes timeout
                                $status = "Online";
                        } else {
                                $status = "Offline";
                        }                      
                       
                        # echo the user profile data
                        echo "<p>User ID: {$user['id']}</p>";
                        echo "<p>Username: {$user['username']}</p>";
                        echo "<p>Name: {$user['name']}</p>";
                        echo "<p>First Line of Address: {$user['visitor_firstline']}</p>";
                        echo "<p>Second Line of Address: {$user['visitor_secondline']}</p>";
                        echo "<p>Town: {$user['visitor_town']}</p>";
                        echo "<p>County: {$user['visitor_county']}</p>";
                        echo "<p>Postcode: {$user['visitor_postcode']}</p>";
                        echo "<p>Telephone Number: {$user['visitor_tel']}</p>";
                        echo "<p>Mobile Number: {$user['visitor_mobile']}</p>";
                        echo "<p>Car Model: {$user['visitor_model']}</p>";
                        echo "<p>Car Number Plate: {$user['visitor_plate']}</p>";
                        echo "<p>{$row['description']} expiry date: {$row['renewal_date']}</p>\n";
                       
                        /*echo "<p>Car MOT Expiry Date:&nbsp;" . date("d/m/Y", strtotime($user ['renewal_date'])) . "</p>";
                        echo "<p>Car Insurance Expiry Date:&nbsp;" . date("d/m/Y", strtotime($user['renewal_date'])) . "</p>";
                        echo "<p>Car TAX Expiry Date:&nbsp;" . date("d/m/Y", strtotime($user['renewal_date'])) . "</p>";*/

                       
                } else { // 0 = invalid user id
                        echo "<p><b>Error:</b> Invalid user ID.</p>";
                }
}

}

// showing the login & register or logout link
if (logged_in() == true) {
        echo '<a href="logout.php">Log Out</a>';
} else {
        echo '<a href="login.php">Login</a> | <a href="register.php">Register</a>';
}
?>
 


That just gives me the error MySQL error no 1052 : Column 'visitor_id' in on clause is ambiguous

UPDATE:

I just changed the $sql to the following

Syntax: [ Download ] [ Hide ]
$sql = "SELECT u.id, u.username, u.name, v.visitor_firstline, v.visitor_secondline, v.visitor_town, v.visitor_postcode, v.visitor_tel, v.visitor_mobile, v.visitor_model, v.visitor_plate, i.description, r.renewal_date
                FROM renewal r
                JOIN item i ON r.item_id = i.item_id
                JOIN users u ON visitor_id = u.id
                JOIN visitors v ON v.visitor_id = u.id
                WHERE r.renewal_date > NOW()"
;
 


I got no errors but no data, sorry

I am trying to work it out myself at the same time in between getting replies, sorry


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 7:43 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada
And it is. When you're selecting columns from multiple tables, you need to specify which table each column comes from.

_________________


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 7:45 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada
Syntax: [ Download ] [ Hide ]
JOIN visitors v ON v.visitor_id = u.id

This looks like it's probably backwards. Can't know for certain without having seen the DB schema.

_________________


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 7:53 am 
Offline
Forum Contributor

Joined: Tue Sep 30, 2014 5:27 am
Posts: 420
below is the visitors table structure

Syntax: [ Download ] [ Hide ]
-- phpMyAdmin SQL Dump
-- version 4.0.7
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 29, 2015 at 01:48 PM
-- Server version: 5.5.42
-- PHP Version: 5.3.28

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `databasename`
--

-- --------------------------------------------------------

--
-- Table structure for table `visitors`
--

CREATE TABLE IF NOT EXISTS `visitors` (
  `visitor_id` int(11) NOT NULL AUTO_INCREMENT,
  `visitor_name` varchar(255) NOT NULL,
  `visitor_email` varchar(255) NOT NULL,
  `visitor_firstline` varchar(255) NOT NULL,
  `visitor_secondline` varchar(255) NOT NULL,
  `visitor_town` varchar(255) NOT NULL,
  `visitor_county` varchar(255) NOT NULL,
  `visitor_postcode` varchar(255) NOT NULL,
  `visitor_tel` varchar(255) NOT NULL,
  `visitor_mobile` varchar(255) NOT NULL,
  `visitor_model` varchar(50) NOT NULL,
  `visitor_plate` varchar(255) NOT NULL,
  PRIMARY KEY (`visitor_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=76 ;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Below IS the users TABLE structure

-- phpMyAdmin SQL Dump
-- version 4.0.7
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 29, 2015 at 01:51 PM
-- Server version: 5.5.42
-- PHP Version: 5.3.28

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `databasename`
--

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `status` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`),
  UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=15 ;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Below IS the renewal TABLE structure

-- phpMyAdmin SQL Dump
-- version 4.0.7
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 29, 2015 at 01:51 PM
-- Server version: 5.5.42
-- PHP Version: 5.3.28

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `databasename`
--

-- --------------------------------------------------------

--
-- Table structure for table `renewal`
--

CREATE TABLE IF NOT EXISTS `renewal` (
  `renewal_id` int(11) NOT NULL AUTO_INCREMENT,
  `visitor_id` int(11) NOT NULL,
  `item_id` int(11) NOT NULL,
  `renewal_date` date NOT NULL,
  `date_notified` datetime DEFAULT NULL,
  PRIMARY KEY (`renewal_id`),
  KEY `renewal_id` (`renewal_id`),
  KEY `renewal_id_2` (`renewal_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=181 ;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Below IS the item TABLE structure

-- phpMyAdmin SQL Dump
-- version 4.0.7
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 29, 2015 at 01:52 PM
-- Server version: 5.5.42
-- PHP Version: 5.3.28

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `databasename`
--

-- --------------------------------------------------------

--
-- Table structure for table `item`
--

CREATE TABLE IF NOT EXISTS `item` (
  `item_id` int(11) NOT NULL,
  `description` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


Hope that helps when you mentioned the DB schema


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 7:57 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada
I take it back, then. Carry on.

_________________


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 8:04 am 
Offline
Forum Contributor

Joined: Tue Sep 30, 2014 5:27 am
Posts: 420
does it look ok coding wise as confused why the page is not retrieving any data from the database?


Top
 Profile  
 
PostPosted: Mon Jun 29, 2015 8:07 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada
Have you run the query directly in MySQL?

Syntax: [ Download ] [ Hide ]
if ($result->num_rows == 1)

What if you have more than one result?

_________________


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group