List Info

Thread: note 78043 added to function.mysql-field-table




note 78043 added to function.mysql-field-table
user name
2007-09-25 06:49:58
In the official example, there is a mistake.

<?php

[...]

$table = mysql_field_table($result, 'name');

[...]

?>

The last argument is here a string and not the integer
expected by the function.
Indeed, in the synopsis, the two arguments' types are :
result and integer.

Here is an other little example that corrects the mistake
and give another use of the function.

<?php

// Build a very easy request
$query = "SELECT account.*, country.* FROM account,
country WHERE country.name LIKE  '%france%' AND
account.country_id = country.id";

// Gets the result from the DB
$result = mysql_query($query);

// Lists the table name and then the field name
for ($x = 0; $x < mysql_num_fields($result); $x++)
{
	$str = mysql_field_name($result, $x);
	print ('<b>' . mysql_field_table($result, $x) .
'</b>: ' . $str . '<br />');
}

?>

In this little code, the offset is given to mysql_field_name
as the second argument.
----
Server IP: 194.246.101.61
Probable Submitter: 62.23.193.34
----
Manual Page -- http://www.php.net/manual/en/function.mysql-field-tab
le.php
Edit        -- https://master
.php.net/note/edit/78043
Del: integrated  -- h
ttps://master.php.net/note/delete/78043/integrated
Del: useless     -- http
s://master.php.net/note/delete/78043/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/78043/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/78043/spam
Del: non-english -- 
https://master.php.net/note/delete/78043/non-english
Del: in docs     -- http
s://master.php.net/note/delete/78043/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78043
Reject      -- https://mast
er.php.net/note/reject/78043
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


note 78043 deleted from function.mysql-field-table by nlopess
user name
2007-10-19 07:12:08
Note Submitter: PoMdaPiMp 

----

In the official example, there is a mistake.

<?php

[...]

$table = mysql_field_table($result, 'name');

[...]

?>

The last argument is here a string and not the integer
expected by the function.
Indeed, in the synopsis, the two arguments' types are :
result and integer.

Here is an other little example that corrects the mistake
and give another use of the function.

<?php

// Build a very easy request
$query = "SELECT account.*, country.* FROM account,
country WHERE country.name LIKE  '%france%' AND
account.country_id = country.id";

// Gets the result from the DB
$result = mysql_query($query);

// Lists the table name and then the field name
for ($x = 0; $x < mysql_num_fields($result); $x++)
{
	$str = mysql_field_name($result, $x);
	print ('<b>' . mysql_field_table($result, $x) .
'</b>: ' . $str . '<br />');
}

?>

In this little code, the offset is given to mysql_field_name
as the second argument.

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )