Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Comparing Values Of 2 Arrays Combined With Mysql Field Names


I am trying to create an edithistory table that has a text column into which I will put a string that can be read using strtok later to revert changes if necessary. I want to build this function so that it's dynamic enough to be applied to every table so that I don't have to write one for each table that might be updated.

When a row is added to any table (a new entry), it retrieves the next available editid # from the edithistory table and assigns it to that item in the "edits" column for its row in its own table. Every edit made is a new entry in the edithistory table (entryid auto_increment primary key), and the editid is a reference back to the object being edited. Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Print Out A List Of All Mysql Field Names
I'm trying to make a drop down menu which has got a list of all field names that are in a database so you can do a search in each field seperatly but i can't find out how to do it.. can it be done with mysql_field_name and if so then anyone knows how ??

Results Of Same Field Names But Different Tables In MySQL Query.
I have a SQL string with a couple of JOINs that works perfectly in
command prompt. I get results for all the fields selected just fine.
But when I put it into a PHP page, I can't make variables(?) out of
fields that have the same field name from different tables.
Here's the SQL statement:

$sql = "SELECT orders.companyid,orders.ordernum,orders.address,tb l_ih_accounts.company,tbl_ih_accounts.address
FROM orderstatus ".
"LEFT JOIN orders ON (orderstatus.ordernum = orders.ordernum) ".
"LEFT JOIN tbl_ih_accounts ON (tbl_ih_accounts.id = ihid) ".
"WHERE submitted <> 'yes' ORDER BY orders.ordernum ASC";

Then in the "WHILE" clause after the database is queried:
$o_address = $row[orders.address];
$ih_address = $row[tbl_ih_accounts.address];

I've tried it without the table names in the $row statements, but then
I'll just get the results for tbl_ih_accounts.address.
I'm thinking there must be some way to uniquely "name" the results of
a particular field up in the SQL statement, and then just use that
unique name in the WHILE. But I have no clue, and can't find anything
about anything like that.

Setting Variable Names Using Field Names?
I'm having trouble creating dynamic variables using field names. Basically I got a heap of fields named after Players and I want to grab the field name and make a variable called it while assigning it a value from a post variable which is also the player name.

This is the code I'm using:
$result=mysql_query("SELECT * FROM playerstats");

while($fld = mysql_fetch_field($result))
{
if ($fld->name!='match_id' && $fld->name!='opponent' && $fld->name!='map')
{
$fld->name=$_POST[$fld->name];
}
}

Comparing User Input Values In A Form With Database Values
I want to compare user input values in a form with my database.
Basically I want to check whether the user exits in my database.
What mysql command can do that?

MySQL Field Type For Arrays
What type of field type are arrays stuffed into? VARCHAR ? TEXT?

Post Two Values Into One Mysql Field?
I'm posting data into a MYSQL database, which works fine using the schema below and the php form below:

cms_test
story_id (int 3)
web_date (date)
web_time (time)

Code:

Mysql Null Field Values Not Being Returned
is there a workaround for rows with null values not being returned? I am
using PHP 4.3.2 and mysql. the mysql_fetch_array just seems to ignore some
of the latest rows with null values.

Comparing Two Arrays
What i need to do is compare two arrays and return an array that only
has those that are not in the main table.It's similar to what you could
do with SQL.

Array 1 - List of Everything
Array 2 - List of Some of Array 1

What i want to obtain is Those of Array 1 that are not in Array 2. I
would prefer not to do the following:

function getUnique($array1, $array2) {

foreach ($array1, $key => $value) {
$array2_key = array_search($array2,$value)

if ($array2_key === false)
$result_array[] = $value;

}

return $result_array;
}

Is there any simplier way of doing this...any predefined function in
php that could do this?


Comparing Arrays
I've got two uploaded files which I need to find out the diffrencies between. So I read them into two arrays and though I could compare them. And when I looked at the files, the problem arose. Coz the files looks like this: Code:

Comparing IDs In Both Arrays
What I have is a SELECT statement which gets the qsids and plonks them into an array..
PHP Code:

Comparing Arrays
My program has 2 sets of data. One is the id column from a tab delimited file and it needs to be compared with the id column returned from a mySql query. The program needs to start with the data in the tab file id column and then compare ONE of the tab file ids to ALL of the ids in the user table. If a match is found, an Update query is run. If a match is not found, an Insert query is run. Code:

Comparing Arrays
I have a MySQL database which has a load of musicians on it. Each musician has a field that stores their influences, which are separated by commas, e.g: The Beatles, The Beach Boys, Kiss etc etc.

Now, what I would like to do is start with the influences of one musician, and then compare it to all the others to find the closest matches - i.e find the musicians that have (say) more than three influences i common. This would then allow you to see which musicians had the most influences in common with the primary one, the one you started with.

Here's what I have in mind, it seems a little laborious - load the influences of the primary musician into an array using the explode command. Then step through each of the other musicians in a loop, each time putting their influences in to an array and checking to see how many matches there are between the two arrays. Whenever there is at least one match, the name of the musician and the number of matches would be put into a third array. This array would then be sorted at the end, so that the musicians with the most matches would be at the top, and the script could then display them.

This would probably work, but if looking at several hundred or several thousand musicians, it would surely be quite slow - is there a better way? I don't particularly want to use a separate, normalised table at this point - I know it would be the quickest way but it would involve a lot of restructuring for me. I know that PHP has several clever inbuilt routines that might do this job for me, so if anyone can suggest anything I'd appreciate it.

Comparing 2 Arrays In A Loop
I have 2 arrays:

$array1[] = 'hello';
$array1[] = 'how';
$array1[] = 'are';
$array1[] = 'you';
$array1[] = 'bob';

$array2[] = 'hello how';
$array2[] = 'are you steve';

I want to compare $array1 with $array2, and if any value of $array1 is found in $array2 I want to perform an action I know this has to be in a loop, i'm confused about how to set it up.

Searching Two Arrays Fully And Comparing
I'm trying to find matching pages by searching two arrays against each other. The arrays get the keywords from the current page and others stored in a database.  I'm not very good with PHP but what I'm doing at the moment is actually working, except it's only printing one found keyword when there are more. Code:

Comparing Array Values
I'm developing a database that holds information about crew members. There are 7 categories of service types. Crew members can be associated with any number of categories.

I'm working on an update form to add or delete categories for a crew member. I first issued a query to find the member's categories. I issued a second query to list all possible categories. I want to show a checkbox for any possible categories that aren't in the member's individual category list. If the member is in categories 1 and 2, but not in 3 or 4, I want to show a checkbox for categories 3 and 4.

I can get the two category lists to print, but I can't figure out how to compare them.

Here is the code I have for the select statements:

Generates the list of member categories:
$cat_query = "SELECT crew_category.crew_id, crew_category.category_id, category.category_desc
FROM crew_category, category
WHERE crew_category.crew_id = "$crew_id" and crew_category.category_id = category.category_id";

$cat_result = mysql_query($cat_query);


Generates the list of all possible categories:
$all_cat_query = "SELECT category_id
FROM category";

$all_cat_result = mysql_query($all_cat_query);


I'm just developing my programming skills (as I'm sure you can tell), so I apologize for my ignorance! Thanks in advance to anyone who can help!

Looking For Windows Mysql/php/webserver Combined Package
A while ago I found a mysql/php/webserver bundle of software for windows
that installed all three at once and made it easy to start developing
sql/php web apps. Now I can't remember what it was or where to get it,
and wondered if anyone here can suggest anything along those lines?

Pdo Get Field Names
I'm using PDO for the first time. I want to get the field/column names
from a SELECT query. I can get the names from the associative array
returned by fetch(). But how do I get the field names if the SELECT
query returns no rows? I could do this before with the
xxxx_fetch_field() functions.

Here's a condensed version of my code:

// query the database
$DbToQuery = new PDO("sqlite::memory:");
$DbToQuery->query("CREATE TABLE MyTable (MyField TEXT)");
$sql = "SELECT * FROM MyTable";
$result = $DbToQuery->query($sql);
// Get the number of columns
$Cols = $result->columnCount();
// Loop through the results
$countrows = 1;
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
if($countrows == 1) {
// Print column names
print join(",", array_keys($row));
}
$countrows++;
// handle the row data
// ...
}

Dynamic Variabel Names In Arrays
I have a php script that makes multiple sql query's that results multiple datasets that I will use in a graph. Its set up something like this.

for($i=0; $i<$n; $i++){
sql query runs here n times and produce each time a dataset that looks like.

2007-10-17    3
2007-10-18    4
2007-10-19    2

I want to put each dataset in an Array with diferent name.
I manage to put on dataset it in one array

$ydata[] = $row[1];
$xdata[] = $row[0];
}

but I need one array of every dataset with names that I can recognize outside the loop, for eks a dynamic variabel name that consist of $i and some other name. like $i.$xdata[], but I cant make this work.

Listing Field Names - Confusion
I'm trying to simply list the names of fields within a certain table. On another page I figured out how to list the available tables within a database, using the list_tables & table_name, so I figured I could do the same using the list_fields & field_name - but it doesn't seem to be working.

Code so far: (works with table list/name)

<?

$connect = mysql_connect("localhost","login","pass");

$result = mysql_list_fields($db,"tablename");
$i = 0;
while ($i < mysql_fetch_array($result)) {
$tb_names[$i] = mysql_field_name($result, $i);

echo "$tb_names[$i]<br>";

$i++; } ?>

Count The Number Of Names In A Field
I want to count the number of names in a field to a web page. I use the following line to gather the data and store to a variable:

$tally=mysql_query("SELECT count(*) FROM fname",$db);

I use the next line to post it: print $tally;

The output on the web page should be the number of rows counted in the field but I get:
Resource id #2 .

Variable Values As Session Names?
I'm using sessions, and i was wondering how I would set a session name as the value of a variable.

How To Process Dynamic Form Field Names
Let me start by saying I don't have a lot of PHP experience, and am just starting to fumble my way around some of this stuff... I'm sure this has been asked a number of times, but after 2 days of searching the internet, I just haven't found a solution that makes sense, so I am hoping someone here can help me.

I have a pretty simple project schedule sort of web page that lists a number of tasks & 4 dates associated with each task. (planned start, planned complete, actual start, actual complete.

The page is built dynamically based on what is in a mysql database, and the dates listed are form fields, with the intent that a person with access can change any number of these dates.

Each task has an id associated with it, so when i build the form, I name the form field <task_id>-<date type>. so, for example, for task id = 10 I have 4 related form fields:

10-planned_start
10-planned_complete
10-actual_start
10-actual_complete

This basic pattern is repeated for all the tasks (up to 100 right now, but it could grow slightly).

Once all the form fields have been updated, and the user clicks submit I want to update the data in the database with the appropriate data.

So, my questions is:

1) How can I process this form, when I don't know what the names of the fields are going to be, and/or how many fields there are?

2) Is there a good way to identify only those fields that have changed and do updates on only those fields, or am I "stuck" updating all the records, even those where the dates have not changed from when the form was built?

Extract Form Field Names When They're Not Known In Advance
I have a page with a form which has automatically generated fields, (which come from mysql column names). There could be any number of these fields, and I have no way of knowing exactly what they're called. But obviously I need to know their names, in order to extract their values on the submission page.

They are either of the form c%status#, e%status# or t%status#

% is a number between 1 and 13 (inclusive)
# could be anything in the pattern 01, 02, 03, with no limit

Eg: fields could be c2status03 and e4status07, but I don't know this in advance. These would be generated on the fly from mysql.

But on the submission page I need to be able to generate the code $var1=$_POST['c2status'] and $var2=$_POST['e4status07']

Is there a way for me to somehow get these names so I can extract their values on the submission page? Or have I hit a dead end?

Dont Want The File Names In The Browser Address Field
Is there a way in PHP where the file name do not appear in the browser address field.

eg. the url of a file is : http://www.somedomain.com/somepage.php.

but when a link to this page is clicked, only http://www.somedomain.com should show up in the browser address field.

Handling Case Of Field Names In Multiple Db's
(Bottom line: I think what I'm looking for is an easy way of changing
the case of key values in an array.)

I've got code that I'm trying to make agnostic about the underlying
database system I'm using. That is, I want the code to work whether
the underlying db is MS SQL, MySQL, Oracle, etc. I'm using the PEAR DB
package, and it's great for what I'm trying to do...except in one
area. I get the returned row fields in an associative array, where the
element key is the field name and the element value is the field
value. The problem is that MS SQL returns field names in mixed case
(actually, it returns the field names in the case the user used to
define the field names in MS SQL in the first place), while Oracle
returns the field names all caps. So, if I have the same db on MS SQL
and on Oracle, I can't easily access the field values.
For example:

$row*=*$result->fetch_row(DB_FETCHMODE_ASSOC);

Now, if I print_r($row), I see something like:

Array*(
***[My_Id]*=*1;
***[Name]*=*"Fred Flintstone";
)

If I run this under an Oracle db, I might get this, instead:

Array*(
***[MY_ID]*=*1;
***[NAME]*=*"Fred Flintstone";
)

So my code cannot say something such as:

$id*=*$row["My_Id"];

That would work for the MS SQL version, but not for the Oracle
version. I certainly don't want to say something like:

if*($IsMsSql)*$id*=*$row["My_Id"];
else*$id*=*$row["MY_ID"];

I really don't have control of how the users define the case of their
field names, otherwise I could tell them to upper-case them all the
time. But that might not work, if a different set of db routines that
DB uses returns field names in all lower case.

I could do the following, but I'm not sure I want to take the
efficiency hit (maybe it isn't so bad; I don't know):

foreach*($row*as*$key*=>*$value)*{
***$row*[strtoupper($key)]*=*$value;
***unset($row[$key]);
}

Assigning Values To Arrays
I am performing a MySQL SELECT (which returns multiple rows) to
$result and then extracting the results with
mysql_fetch_array($result).
I then want to build a number of arrays using the fields of each row.
Here is the relevant code:
<snip>
$result =
$i = 1;
while ($row = mysql_fetch_array($result))
{
extract($row); /* break the row into its fields */
$array0[$i] = $row[0]; /* 1st Field of Row */
$array1[$i] = $row[1]; /* 2nd Field of Row */
$array2[$i] = $row[2]; /* 3rd Field of Row */
$i++;
}
</snip>

Getting Values In An Array Of Arrays
The following is the output of a print_r on an array. The value of
element[0] is itself an array. How do I access the elements in the
second array?

Array ( [0] =Array ( [Vancouver] =Vancouver [Eugene] =Eugene
[Beaverton] =Beaverton ) )

I've tried to set $c[] = $city[0], but this just outputs the same
result.

Inserting Values Into Database Using Arrays
I'm trying to insert the database the answers to a question and to get the user to select the correct answer. PHP Code:

Foreach Loop Contains Arrays In Some Values
I'm looping through the keys and values of a form submission using

foreach($_POST as $key => $value)
echo "$key = $value<br>";

No problems there. All works as expected. But seveal of the values are
arrays and the echo comes out like:

subjectone = Array
subjecttwo = Array

There could be as many as 9 elements in each array but there may be as
few as one. How can I get those $value that are arrays to echo the
entire array using a foreach loop? I would like to end up with all
values printed in the page whether in an array or not.

How To Slice Multidimensional Arrays By Row Values?
From a DB query, I receive the following result set:

array(array('key1'=>'some val', 'key2'=>'some other val', ..., n),
array('key1'=>'some val', 'key2'=>'some other val', ..., n),
array('key1'=>'some val', 'key2'=>'some other val', ..., n),

Pass Values Of Arrays To A New Page
How do i pass all the values onto another page that I have gathered. If I have a form and place info into the array, how do I pass the value in that array over to a new page.

Syntax For MIN And MAX Values Of A Field In A Table
I wish to assign a variable name to the MIN and MAX values of a field
in a table. The type is int(7).

I am extracting the field with many others with the following code
from a php call.

$ml_collect='SELECT * FROM ml_lopp LEFT JOIN scfmforening ON
(scfmforening.scfmnum=ml_lopp.scfmnum) LEFT JOIN ml_newtidplats ON
(ml_newtidplats.loppnum=ml_lopp.loppnum) ORDER BY date1,
ml_lopp.loppnum'

$ml_upg=mysql_query($ml_collect);

mysql_close();

The field is contained within the table ml_lopp and it is called
loppnum

I have been trying combinations of this to extract the min and max of
the field from the $ml_upg variable which includes all of the data to
be processed.

$lownum=mysql_result($ml_upg,MIN('loppnum'));
$hghnum=mysql_result($ml_upg,MAX('loppnum'));;

Which does not work.

Passing Checkbox Values Into The Correct Arrays
I've been looking at some code and the net for the past few hours trying to figure out what's wrong and I'm stumped. I have a form - multiple checkboxes (different names) and text fields going into an array. The text fields behave fine - the values from the first entry will populate elements of the first array.

The weird part is that the check boxes will pass the correct values but not always to the correct array element. For example, given two check boxes in a 2 element array, if you check the 1st box in the first element and the 2nd in the second element, on submission, the second element populates the first array element.

I've included a snippet of the code as an example - it's echoing things like crazy because I've been trying to see what's been going on. I hope someone can figure this out for me 'cause I'm completely stuck and am on a deadline. Code:

Storing Values In Arrays Not Their References Or Formulas
We start off by getting the Sire ID from thisDog.  Now I want that SireID fixed so that no matter how many times I go back to it. that Sire will be the same dog as he was the very first time. Code:

Returning Values From Decimal Or Integer Field
I have created a table with a column "Price" defined as Decimal(10,2). There are two records for articles with prices of 99.95 and 14.95. Within PHP I have the following lines: Code:

Inserting Then Extracting Multiple Values In Single Db Field.
I need to submit multiple values into a single table field that have been retrieved from a form eg: limit1 ... limit10. At the moment they are seperated by commas in the field (limit1,limit2 etc) thinking I extract these with explode() then assign them as individual variables ($limit1 etc.) so they can be edited by the same form.

Comparing PHP Array From Checkbox To MySQL Table
My problem involves updating a MySQL table using checkbox input. I'm relatively new to both PHP and MySQL so I'm looking for a little direction on the smartest way to accomplish my goal.

When a user goes to a project page, they are able to categorize their project by area. The user checks a series of checkboxes and the results are stored in an arrays called $category_ids. I'll called the project id $project_id.

What I want to do is compare the array $category_ids to entries in a MySQL table for $project_id. Then I want to add the links that aren't already in the table and delete the ones that need to be deleted. The table has these fields:

projects_cat_link (table)
----------------------
category_id ¦ project_id (fields)

Does anyone have any tips on how to do this? I've gathered that maybe there's a way to get the MySQL data into a similarly formed array and then use functions like array_diff to compare. But then I'm not sure how to use the comparison in a MySQL query to add/edit/delete the links.

Select Both Field Name And Field Value- Mysql ?
What function to use to select both field name and field value from a mysql table ?

Php Combined With Html
I know that you can combine PHP with HTML and name the file with the php extension but what I was wondering, does it seem to cause alot of problems for people when doing this?? Why am I asking this you wonder?

Well I have a website thats mainly HTML (all but the contact page) and I needed an image hosting script so I got one and combined it with my HTML template, renamed it .php and at first it worked but now its gone all wonky!! I cant seem to figure out what went wrong or if I had mistakingly changed something but I have been on this for hours and hours and now I have a headache and am fed up.. Code:

Displaying MySQL Column Names Using PHP
I'd like to be able to display the column names of a table on a page. Is there a way to read that information in using SHOW? And then to display that information again? Or would I have to store these names in a seperate table and display these values?

I tried this, but it sure didn't work:
$result = mysql_query ("show columns from industries");

print ("<table>");
if ($row = mysql_fetch_array($result)) {
do {
print ("<tr><td bgcolor=#cccccc>");
print $row["field"];
print ("</td><td bgcolor=#cccc00>");
print $row["type"];
print ("</td><td bgcolor=#cccc00>");
print $row["null"];
print ("</tr>"); }
while($row = mysql_fetch_array($result)); }
else {print "Sorry, no records were found!";}

print ("</table>");

Numeric Column Names In Mysql?
i am trying to create a table with a column name called 2004. But I
keep getting a mysql error? Is there any workaround?

Unable to execute: You have an error in your SQL syntax. Check the
manual that corresponds to your MySQL server version for the right
syntax to use near &#55614;&#57156; TEXT,2004_reference TEXT,2005
TEXT,2005_reference TEXT,200

CREATE TABLE test (id int(6) NOT NULL auto_increment, membership_number
TEXT,first_name TEXT,last_name TEXT,spouse TEXT,phone_priv
TEXT,phone_bus TEXT,address_street TEXT,addr_town TEXT,addr_city
TEXT,membership TEXT,donor TEXT,1998sa TEXT,1999sa TEXT,2000sa
TEXT,200s1 TEXT,2002sa TEXT,2003sa TEXT,2003_reference TEXT,2004
TEXT,2004_reference TEXT,2005 TEXT,2005_reference TEXT,2006
TEXT,2006_reference TEXT, PRIMARY KEY (id),UNIQUE id (id))

Counting Names In Mysql Database
I want is to have the number aof how many times a name is existing in a table_row. you know, my tably is like this status author text:

1 dominik hasjfghkasdfhsk
1 dominik djwkhflwjfv
1 egon jdskljfsldjf

I want php to count dominik and view the result on a php-page.l

Creating A Combined Reference Number
I would like to create a simple reference number for example a customer and an order.

currently i am using auto_increment ids to perform all dbase queries, which is fine for the dbase, however i also want a more meaningful representation of details for users.

e.g.

customer name = bob hoskins
companyname = vcom
dbase id = 78
= bovc78

so essentially i want a bit of each string to make one. i know how to use concatenate, however i dont know how to limit the number of chars used in each part of the string.

Multiple SELECT Queries Combined
I have several SELECT queries on a few of my webpages, and I have been told that the more query connections that are open the slower the server will run.

So firstly, is it possible to merge/combine 2 SELECT queries into a single query? Code:

Variables Combined With String In SQL Statements
I get this error "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' , , , , , , , , , , , )' at line 1"

My sql statement is this:

mysql_query("INSERT INTO players (player_id, match_id, kills, deaths) VALUES ('$user_id', ".$_POST['match_id'].",".$_POST['kills$username'].", ".$_POST['deaths$username'].")") or die ('Error adding new player '.mysql_error());

I'm thinking it must be to do with me combining string and variables together.
So is ".$_POST['kills$username']." correct?

MySQL Query - How To Select Names With Out Duplicates
I want to select names from a database
ie:
Dog
Dog
Dog
Cat
Bird
Bird

I want something where I can select >Dog, Cat, Bird instead of the three dogs and two birds. Can I do that?

Add Form Field Values Into Php Seesion Variable Before Submitting The Form
I have php page which is basically a simple html form containing some text fields.The user will type in values in it and submit it .Now what i want is that just at the time of submittion i want to assign the form field values in session variables.

I nwwd this b'coz the form is being submitted into a cgi script which has been given to me.Now the cgi script is an executable one and i am unable to view or change its content,Its functionability is to change a password for a linux user account .Now the cgi script after completing the job is redirected to another html page.What i have to do is that i need to trap the user input and update the values in a mysql database .Now if i can assign the values in a session variable then i can do the updatation from some later pages.

Selecting Array Rows Based On An Array Of Field=>values
Here's the code i have:

$db = array(); //main array
$db['main'] = array(); //table `main`
$db['main'][] = array('id'=>0,
'username'=>'joshfrench','userpass'=>'password','userlevel'=>'admin');
//row
$db['main'][] = array('id'=>1,
'username'=>'bob_smith','userpass'=>'psswrd','userlevel'=>'user');
//row

function trim_value(&$value){
$value = strtolower(trim($value));
}
function fdb_select($fields = "*", $table, $where = false, $limit =
false){
global $db;
$retv = $db[$table];

//LIMIT RESULTS TO FIELDS
if(strrpos($fields, ",") === false){$field=array($fields);}else{$field
= explode(",", $fields);};
array_walk($field, "trim_value");
$all_fields = array_keys($retv[0]);
if($fields == '*'|| is_null($fields)){$field = $all_fields;};
$field = array_uintersect($all_fields, $field, "strcasecmp");
$retvi = array();
foreach($retv as $num =$row){
foreach($row as $fname =$fvalue){
$fname1 = strtolower($fname);
if(in_array($fname1, $field)){
$retvi[$num][$fname]=$fvalue;
};
};
};
//DONE LIMITING TO FIELDS
if($where != false){

//UP TO HERE IT WORKS FINE
//LIMIT TO WHERE CLAUSE
$retvj = array();
foreach($retvi as $num =$row){
//IN THE ROW
foreach($where as $k =$v){
//IF ROW MEETS ALL REQUIREMENTS
if($row[$k] == $v){
$retvj[] = $retvi[$num]; //Keep that row
};
};
};
//DONE LIMITING TO WHERE CLAUSE
};
$retvi = (isset($retvj)) ? $retvj:$retvi;
//SEND A FINAL ASSOCIATIVE ARRAY
return $retvi;
};
print_r(fdb_select("*", "main", array('id'=>"1",
"username"=>"joshfrench")));

the previous code outputs this:

Array
(
[0] =Array
(
[id] =0
[username] =joshfrench
[userpass] =password
[userlevel] =admin
)

[1] =Array
(
[id] =1
[username] =bob_smith
[userpass] =psswrd
[userlevel] =user
)

)

How Can I "reload" The Values Of A Field
I try to "reload" the value of a form - field called name each time the form
is being reloaded. I put this code in the php script:

session_start();
if (isset($name)){
$_SESSION['name'] = $name;
} else {
$name = $_SESSION['name'];
}
......
<input type="text" name="name" value="echo $name;">

however, when I restart the IE Browser and reload the url, then I do NOT get
the value of $name. What do I do wrong?


Copyright © 2005-08 www.BigResource.com, All rights reserved