
lutinFou
Members-
Content Count
13 -
Joined
-
Last visited
Community Reputation
1 NeutralAbout lutinFou
-
Rank
Newbie
-
Foreign Keys
lutinFou replied to Edward's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
Hi, whilts on the subject of foreign keys:I am currently working through the review and persue section of chapter 10, creating delete and edit scripts for the banking database. This database has foreign key constraints (ON DELETE NO ACTON). The database is made up of at least 2 tables (an accounts table [child] and the customers table [parent]) To delete a customer I first have to delete the child [account] that is clear. Question is, when writing my PHP script do I have to do this using 2 separate queries (i.e. DELETE FROM accounts WHERE customer_id=1 ...run that and then the same for -
OK....next question. I am struggling with INNER and OUTER JOINS. How would I write a query to tell me what member of staff speaks which langauge? So far I have come up with: SELECT s.first_name, s.last_name FROM staff AS s INNER JOIN staff_lang USING ( staff_id ); This will just link the "staff" table with the link table "staff_lang" containing the staff_id and lang_id foreign keys. Could anybody give me a tip on how to link the "lang"-->"staff_lang"<---"staff" tables to display the results? Sorry for posting such a basic question, but I am really struggling with this.
-
Hi, i have used the spam_scrubber function on a form in which I have included a drop down list and radio buttons. When I use the spam_scrubber function to validate the other text areas, that it works fine, however once I select something I get a the following warnning message: Warning: stripos() expects parameter 1 to be string, array given in file name on line 18. line 18 is : f(stripos($value, $v)!==false) ) However I think the error is generated from the line $scrubbed=array_map('spam_scrubber', $_POST); i.e. the $value has to be a string for the functi
-
Hi! This is not a question as such, I am mainly looking for somebody to tell me whether I am on the right track or way off the mark. I am currently working through the MySQL chapters, in particular Normalization. i just want to check if I have understood everything corrctly so far. Say I am creating a "language skills database" for an office, where all of the staff speak one or more foreign languages. Staff_id (PRIMARY KEY) first_name last_name email telephone number start_date language The way I understand normalization, I would need to first create table for the staff
-
Hi all, many many thanks to all of you for your help. the "in_array" suggestion form Paul does the trick. In fact after re-reading the section on arrays last night, I realized that the $_POST['selService'] was an array value. I am just was not advanced enough in PHP to know how to to call (I do this all the time - get too far ahead of myself, although I guess that is the way to learn!) Now just got to wait for all the hair I have pulled out over this little problem to grow back hehehehe! Thanks again to you all Jonathan
-
Hi Jonathon, thanks for your help. I understand what you mean, I just seem to be having troble implementing it. I have changed the script somewhat to: echo '<select class="formInputText"name="selService[]"id="selService"multiple="multiple">'; $clientOption=$_POST['selService']; foreach($options as $service){ echo"<option value=\"$service\" if(isset($clientOption)&&($clientOption==$service))echo'selected=\"Selected\"';>$service</option>\n"; } however the line if(isset($clientOption)&&($clientOption==$service))echo'sel
-
Hi, by using the code: //Array containing option values $options=array('Architecture','Interior Design','Dimensional Surveys','Party Wall Surveyors','In-house visualizations','CDM'); //Foreach loop to insert values into HTML echo'<select class="formInputText"name="selService[]"id="selService"multiple="multiple">'; foreach($options as $service){ echo"<option value=\"$service\" if(isset($_POST[$service])&&($_POST[$service]==$service))echo 'selected=\"Selected\"';>$service</option>\n"; } echo'</select>'; ?> Th
-
Hi, first of all....this is a great book! Ok now to my question. I have created a HTML form in which there is a selection box generated by a php foreach loop: <?php //Array containing option values $options=array('Architecture','Interior Design','Dimensional Surveys','Party Wall Surveyors','In-house visualizations','CDM'); //Foreach loop to insert values into HTML echo'<select class="formInputText"name="selService[]"id="selService"multiple="multiple">'; foreach($options as $service){ echo"<option value=\"$service\">$service</option>\n"; } //close