Date: 12/03/99
- Next message: Andreas Otto: "Re: [PHPLIB] Anyone used PHPLIB with Flash?"
- Previous message: Narinda Reeders: "[PHPLIB] Anyone used PHPLIB with Flash?"
- Next in thread: Andreas Otto: "Re: [PHPLIB] db query"
- Reply: Andreas Otto: "Re: [PHPLIB] db query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, 29 Nov 1999, Andreas Otto wrote:
}since i am still quite new and unexperienced using the phplib i now have the
}problem to query my mysql db.
}i have already figured out how to connect to my db but that's it i don't get the
}requested data out of the db.
}
}using "plain php and mysql" i would have done this:
}
}[...]
} <!--content starts here-->
}<script language="php">
}mysql_connect($host,$user,$dbpasswd);
}$query_id = mysql_db_query("$db","select * from $table where art_id = '1'");
}$result = mysql_fetch_array($query_id);
} $art_id = $result[art_id];
} $title = $result[art_title];
} $content = $result[art_content];
} $author = $result[art_author];
} $created = $result[art_created];
} $updated = $result[art_updated];
} $show = $result[art_show];
Bah, ugly... :)
}mysql_close();
}</script>
} <P><FONT CLASS="title"><script
}language="php">print("$title");</script></FONT></P>
} <P><FONT CLASS="normal"><script
}language="php">print("$content");</script></P>
} <!--content ends here-->
A little bit late... sorry I don't read this list every day...
<?php
## this is without testing and directly from head, so be aware,
## that it won't work, but I hope it gives you the kick you need :)
require("db_mysql.inc"); ## has to be in your include path
$db=new DB_Sql;
// btw: bad varnames ($host, $db..), they are polluting your namespace
// use eg. $mysql_host, $myapp_db, $myapp_user or something like this
$db->Host=$host;
$db->Database=$db;
$db->User=$user;
$db->Password=$dbpasswd;
$q="SELECT * FROM $table WHERE art_id='1'";
$db->query($q);
$db->next_record();
$o=$db->Record;
?>
<P><FONT CLASS="title"><?php
echo $o[title]; ?></FONT></P>
<P><FONT CLASS="normal"><?php
echo $o[content]; ?></P>
<!--content ends here-->
--SSilk - Alexander Aulbach - Herbipolis/Frankonia Minoris - (0931)22032
- PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>. To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in the body, not the subject, of your message.
- Next message: Andreas Otto: "Re: [PHPLIB] Anyone used PHPLIB with Flash?"
- Previous message: Narinda Reeders: "[PHPLIB] Anyone used PHPLIB with Flash?"
- Next in thread: Andreas Otto: "Re: [PHPLIB] db query"
- Reply: Andreas Otto: "Re: [PHPLIB] db query"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

