What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » php query help

Pages: (2): « First [ 1 ] 2 » Last »
php query help
Author: Message:
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. php query help
I'm trying to make a interactive page and made a function to query a string from my database.

code:
title_query($id)

however, I want to add it to my database. like this:

code:
Database   ----->    title_query($id)
          <-----
          ------>  Output on the website


It's kinda hard to explain :P, I hope someone understands me and can help me...

I just want to be abled to type in my database: title_query(3) and the ouput on the website should be the result of the title_query(3)

This post was edited on 08-03-2005 at 07:54 PM by Ezra.
[Image: 1-0.png]
             
08-03-2005 07:49 PM
Profile PM Web Find Quote Report
Veggie
Full Member
***

Avatar

Posts: 415
Reputation: 21
37 / Male / Flag
Joined: Sep 2004
RE: php str_replace help
hhmm i dont really foolow, what has this got to do with str_replace?
08-03-2005 07:52 PM
Profile E-Mail PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. RE: php str_replace help
AH, right, well... forgot to say, I was trying to work with str_replace to let it work, but I thought maybe someone here knows another way.
[Image: 1-0.png]
             
08-03-2005 07:54 PM
Profile PM Web Find Quote Report
Veggie
Full Member
***

Avatar

Posts: 415
Reputation: 21
37 / Male / Flag
Joined: Sep 2004
RE: php query help
from the look of that little picture you will need 3 quierys, are you using MYSQL?
08-03-2005 07:56 PM
Profile E-Mail PM Web Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: php query help
i dont get why you need to insert it and get it back out again, if youre inserting it you obviously have it in a variable so why not just output it normally?
08-03-2005 07:57 PM
Profile PM Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. RE: php query help
That's not really what I mean, and yes I use MySql.

I'll try to explain better :P

In my database I type title_query(3), in my code I query the info from the database to the page, but before it ouputs the data to the website I want title_query($id) to be executed.

EDIT:
quote:
Originally posted by Lee Jeffery
i dont get why you need to insert it and get it back out again, if youre inserting it you obviously have it in a variable so why not just output it normally?

Because all the data is in the database, and for every id I need a different query, like title_query(3) or title_query(4)

This post was edited on 08-03-2005 at 08:00 PM by Ezra.
[Image: 1-0.png]
             
08-03-2005 07:58 PM
Profile PM Web Find Quote Report
Veggie
Full Member
***

Avatar

Posts: 415
Reputation: 21
37 / Male / Flag
Joined: Sep 2004
RE: php query help
quote:
Originally posted by Ezra
That's not really what I mean, and yes I use MySql.

I'll try to explain better :P

In my database I type title_query(3), in my code I query the info from the database to the page, but before it ouputs the data to the website I want title_query($id) to be executed.



as far as i know theres no internal function 'title_query' so i asume thats your php function.

code:
$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
   or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('my_database') or die('Could not select database');
$query = 'SELECT * FROM my_table';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
mysql_close($link);

to help theres a basic sql query

This post was edited on 08-03-2005 at 08:03 PM by Veggie.
08-03-2005 07:59 PM
Profile E-Mail PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. RE: php query help
Well... I have a basic lay-out and all the data is in the database. And if you change the id number the data changes but not the lay-out.

That's why I need to add the query to the database.

http://imdb.tsdme.nl/profile.php?id=1
http://imdb.tsdme.nl/profile.php?id=2


That's my function

code:
function title_query($id){
global $title;
$title = mysql_fetch_array(mysql_query("SELECT `title` FROM `imdb_data_title` WHERE id=".$id));
echo $title['0'];
}

At the first link where it says title_query()(3), I want it to change to the title of the movie, that is stored in the database with that query

EDIT: Basicly I want to store a piece of my php code in my database to be executed later

This post was edited on 08-03-2005 at 08:16 PM by Ezra.
[Image: 1-0.png]
             
08-03-2005 08:04 PM
Profile PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
O.P. RE: php query help
I tried and tried and tried, and couldn't get it working...

So I thought about another thing a function that looks for special tags and changes them to data from another table.

Example:

Ezra made a great movie called [[t13]] which is made in the year [[y13]] and is the next big hit next to [[t11]] made in [[y13]].

This means that the T stands for title of row 13, and Y for the year from row 13

Does anyone think he knows how to make this or help me to make this :)

Any help is appreciated

[Image: 1-0.png]
             
08-03-2005 11:19 PM
Profile PM Web Find Quote Report
jren207
Senior Member
****

Avatar
JR! - We <3 Fanta

Posts: 870
Reputation: 28
35 / Male / –
Joined: Sep 2003
RE: php query help
code:
<?php
$id = $HTTP_GET_VARS['id'];
function query_db(){
global $id;
$query_q = mysql_query("SELECT * FROM imdb_data_title WHERE id = '$id'");
while($query_row = mysql_fetch_array($query_q)){
$output = ('<b>Title:</b> <i>' . $query_row['title'] . '</i><b> Year:<b> <i>' . $query_row['year'] . '</i>');
}
return $output;
}

echo('' . query_db() . '');



This post was edited on 08-04-2005 at 01:31 AM by jren207.
08-04-2005 01:31 AM
Profile E-Mail PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On