php-general Digest 10 Apr 2010 21:28:04 -0000 Issue 6685
Topics (messages 303971 through 303972):
wiki api help needed with php
303971 by: saeed ahmed
Inserting into multiple tables
303972 by: Gary
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
I'm trying to do build a system which is described below.
"The user inputs a word. The system check if word exists at portuguese
section of wiktionary. If true,
get and show to user the word definiton. If false, sugest (displays) similar
words, as in Wiktionary,
with her links."
I have done this
http://troyee.com/example/sl_project_36/index.php
using this api
http://en.wiktionary.org/w/api.php?action=opensearch&search=api&format=xml&limit=1
*it is for english word.
Now I stuck with two questions
1. Am I going to the right way?
2. how to handle with portuguese section of wiktionary. which api will use
for this?
I need your useful suggestions please.
-----
Regards
Saeed Ahmed
http://saeed05.wordpress.com
-----
--- End Message ---
--- Begin Message ---
I am experimenting with multiple tables, it is only a test that is my local
machine only. This is the current code, which does not work , I have tried
to concatonate the insert statements. I have tried multiple $query
variables, but it is just overwriting itself (only the last one gets
inserted). I also tried writing the $query as an array, which got me an
error message (saying it was expecting a string and I offered an array).
Someone point me in the right direction?
Gary
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<label>First Name </label> <input name="fname" type="text" /><br /><br />
<label>Last Name </label><input name="lname" type="text" /><br /><br />
<label>Street Address </label><input name="street" type="text" /><br /><br
/>
<label>Town </label><input name="town" type="text" /><br /><br />
<label>State </label><input name="state" type="text" /><br /><br />
<label>Zip Code</label><input name="zip" type="text" /><br /><br />
<label>Telephone</label><input name="phone" type="text" /><br /><br />
<label>Fax</label><input name="fax" type="text" /><br /><br />
<label>E-Mail</label><input name="email" type="text" /><br /><br />
<label>Comments</label><br /><textarea name="comments" cols="100"
rows="15"></textarea><br /><br />
<input name="submit" type="submit" value="submit" />
</form>
<?php
$fname=($_POST['fname']);
$lname=($_POST['lname']);
$street=($_POST['street']);
$town=($_POST['town']);
$state=($_POST['state']);
$zip=($_POST['zip']);
$phone=($_POST['phone']);
$fax=($_POST['fax']);
$email=($_POST['email']);
$comments=($_POST['comments']);
$REMOTE_ADDR=$_SERVER['REMOTE_ADDR'];
$dbc=mysqli_connect('localhost','root','','test');
$query="INSERT INTO address (street, town, state,
zip)"."VALUES('$street','$town','$state','$zip')".
"INSERT INTO comments(comments)"."VALUES('$comments')".
"INSERT INTO contact(phone,fax,email)"."VALUES('$phone','$fax','$email')".
"INSERT INTO name (fname, lname)"."VALUES('$fname','$lname')";
$result = mysqli_query($dbc, $query)
or die('Error querying database.');
mysqli_close($dbc);
?>
</body>
</html>
__________ Information from ESET Smart Security, version of virus signature
database 5016 (20100410) __________
The message was checked by ESET Smart Security.
http://www.eset.com
--- End Message ---