Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 6:43 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: mysql
PostPosted: June 1st, 2016, 11:21 am 
Offline

Joined: January 23rd, 2006, 2:57 pm
Posts: 55
Location: Belfast
Opus: 9.5
OS: Win 7
System: i7 8G ram
Hi Folks

I'm looking to select the total number of records(return a number) using the below with label 'all' linked to an opus variable in post web data. Any thoughts why it does not work. Cheers.



<?php
//connect to MySQL database
$user="xxxxxxx";
$password="xxxxx";
$database="xxxxxxx";
mysql_connect("localhost",$user,$password);
@mysql_select_db($database) or die( "Unable to select database");

$connect = mysql_connect("localhost",$user,$password);
$db = mysql_select_db($database,$connect);
$query = "SELECT * FROM weather1";
$result = mysql_query($query, $connect);

$row = mysqli_fetch_all($result);
$data = $row['all'];
echo $data
?>


For this message paulj has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: mysql
PostPosted: June 4th, 2016, 11:49 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
For starters, you appear to be mixing mySQL and mySQLi. You should only be using the latter.

I've posted a detailed working script already, though the whole post is also worth reading.

viewtopic.php?f=4&t=5684

Some key points:

1. Build the script in steps and check that each works.
2. Make use of browser and console to check PHP responses before you get to the Opus side.
3. Keep an eye on your server logs for PHP errors.

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: mysql
PostPosted: July 22nd, 2016, 9:07 am 
Offline

Joined: January 23rd, 2006, 2:57 pm
Posts: 55
Location: Belfast
Opus: 9.5
OS: Win 7
System: i7 8G ram
Just seeing your post now, Cheers Mack.


For this message paulj has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 13 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

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group