Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 12:07 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: PHP & MySQL
PostPosted: April 17th, 2007, 1:23 pm 
Offline

Joined: April 1st, 2005, 6:59 pm
Posts: 98
Location: Maastricht, The Netherlands
Opus: V7
OS: Mac OS X 10.7.2 | Windows 8 Dev
System: i5 2.7 | 8G Ram | 1 T HD
Hi,

Help needed with the following.

I've got the following PHP script the has as a result 3 records that match the criteria "Peter"

Code:
<?
    $sql = 'SELECT     person, address
        FROM     names
        WHERE     person = "peter"';
    $res = mysql_query($sql,$link);
    if ($res && mysql_num_rows($res) >= 1)
    {
        while ($row = mysql_fetch_array($res))
        {
            echo 'name: '.$row['person'].' address: '.$row['address'].'<br>';
        }
    } else {
        echo 'No data found';
    }
?>


How can I display this result in Opus ? For example:

Field
Person Address
Peter 1 x
Peter 2 y

Hope somebody can help.

Thanks in advance

Regards

Ronnie


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 17th, 2007, 2:13 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Don't use PHP, but there are some tutorials on how to post / read data from a web database. There in the tutorial section.


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 17th, 2007, 2:34 pm 
Offline

Joined: April 1st, 2005, 6:59 pm
Posts: 98
Location: Maastricht, The Netherlands
Opus: V7
OS: Mac OS X 10.7.2 | Windows 8 Dev
System: i5 2.7 | 8G Ram | 1 T HD
Thanks for your reply,

In the tutorial section there is only limited info.

It's like with a access database: multi row output when you have more then one result and display them in an array!

You repleyd with the comment of not to use PHP, whats your advice then??

Regards

Ronnie


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 17th, 2007, 3:11 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Sorry Ronnie,

I meant that I don't use PHP. Having had a quick reread of the Tutorials and look at the Post Web Data action I would guess that it's not designed for reading multi records.

However, I wonder whether it would be possible to to implement this idea:

Run your SQL query but return a count (myX) of the rows

Rerun the query returning the row with the highest Primary ID

Repeat the process myX times but each time set the where clause to exclude any records greater than the last found highest primary ID.

Mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: April 17th, 2007, 3:18 pm 
Offline

Joined: April 1st, 2005, 6:59 pm
Posts: 98
Location: Maastricht, The Netherlands
Opus: V7
OS: Mac OS X 10.7.2 | Windows 8 Dev
System: i5 2.7 | 8G Ram | 1 T HD
Thanks Mackavi,

Will give it a try.

Regards,

Ronnie


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 69 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