How To Simply Display On My Page Another Insert From A Different Table.
$judet = $_GET["judet"];
$result = mysql_query ("SELECT oras, id_oras FROM orase WHERE id_oras = '{$judet}' ORDER BY oras");
This is a piece of my code. The variable $judet is working perfect but i have a problem with another variable in the same table with judet witch i can't call.Everything from table orase works i just don't know how to simply display on my page another insert from a different table.
View Complete Forum Thread with Replies
Related Forum Messages:
Insert Values - Table Has Four Columns To Insert Into
I have a bunch of information that I want to insert into a table insert into TABLE values ('hello','I','am','lost'); pretend that the words that are being inserted are coming from a form for another page. In he case I above I have declared that the table has four columns to insert into. What if I do not know how many columns there are?
View Replies !
Insert Into Table - $query = "INSERT INTO Tbl
I have a small problem which I've been working on for a while. PHP Code: $query = "INSERT INTO tbl(username,ip,link) VALUES("Brin' . $result['id'] . '","$REMOTE_ADDR","http://www.domain.com/sub/start.php?username=Brin"' . $result['id'] . ' )"; mysql_query($query); Any ideas?
View Replies !
Update Table While Insert Data To Another Table
it seem like mine coding din work. [php]<? include("checkin.html"); $conn=mysql_connect('localhost','root','') or die ('Could not connect to server'); $today = date("Y.m.d"); mysql_select_db('hms', $conn); $ok = mysql_query("INSERT INTO check_in(ID,room_no,datein)values ('$ID','$room','$today')", $conn); if( $ok ){ $up = mysql_query("UPDATE studtable SET checked = 'checkin' where [ID] = '%ID'); if(mysql_affected_rows( $up ) == 1) { echo'Checked IN!' }else { echo'No such student to check in' }} else { echo'Check In FAILED, please check again'}?>[php]
View Replies !
How To Display "No Results" Instead Of Empty Table On Results Page
I have a search facility on my homepage for a property lettings website. There are 3 search parametres, location, rent and type (e.g. 1bed). It passes the parametres to the results.php page and displays the results in a table. When there are no results, it still displays a table, but it is empty. How do I display some text that says "No Results" instead of an empty table??
View Replies !
Insert A Page Break For Printing Purposes After X Records On Page.
I need to insert a page break for printing purposes after X records on page. I'm querying five diffrent records with 5 different results and displaying them like: $record1 $record2 $record3 and so on So I want to get total number of records which is pretty easy I just add all the totals let's call it $subtotal. Then I want a page break after every 20 records of the $subtotal. Is this possible?
View Replies !
Create A Form Simply With PHP
I want to know if it is possible to create a form simply with PHP, or if I have to use HTML for it, and if I can use php, how do I send the form data to a flatfile on the server?
View Replies !
Simply Edit And Update Script
Can anyone provide a simple edit/update script. I have only one field that requires updating and the structure is as follows: user_id = username User_password = password url = redirection url I would like to have th option to edit these three fields and I have tried everything. Can anyone help with a simple script?
View Replies !
Creating A Printable Report Simply, Rtf Or PDF
Over Christmas I produced, using PHP and MySQL, a database and front end to record my familys family tree with a short biography and linked photos and locations if desired. All this works fairly well. However, as a followup I'd like to create a report this data as a report (or booklet) in printed format. The simplest and probably least satisfactory way is to format it in very simple HTML and import it into the word processor of choice. Better ways I assume are to export it in PDF or RTF. I am veering toward RTF. PDF - pros: Probably the neatest solution from a user point of view. PDF - cons: PHP was not compliled on my Slackware 10.0 linux system with the pdf functions working. My parents are running XP home, I doubt if phpdev5 (beta) has the same pdf functions compliled in. Basically I don't want to go through the rigmarole of recompiling php on two dissimilar systems. I could generate XLS-FO directly, then use FOP to generate PDF. I would probably spend a lot of time getting this to work under two separate systems, and have to get java working on XP. Hastle if I am not all that familiar with java. I could create a DTD, get my script to produce XML and then use a template and something like sablotron to generate XML. That seems like a sledgehammer to crack a nut. Also, I must be getting the wrong end of the stick with XML, as last time I tried it created far far more work than it saved. Saving effort seems to be a large point of XML. RTF - pros: Since this is basically one step from hand coding, using my script to directly generate rtf is relatively self contained and therefore not dependent on successfully installing a lot of other stuff. RTF - cons: I've still not managed to add images to RTF. RTF is horrid, wrt to human readability of what my scripts are generating, making debugging rather nasty. Even if it works now in open office and word I have no way of knowing I have not created broken RTF that future word processors might balk at.
View Replies !
First In Table Insert
I have a very large form and its anoying to get each form name seperatly and insert them into the database, as you could imagine the sql insert statement will be huge. Is there a way i could 'foreach' the post variables and insert them into the database without using the names from the fields. I mean that could i for example insert into the first field in the table and then the second and so on? i.e. foreach ($post as $key => $val){ INSERT INTO blabla SET (the first field) to $postvar }
View Replies !
Value Not Insert Into Table
Any ideas on why the value for $user is not getting inserted into my database table? Everything else makes it in OK, and I can echo the value on the form, so I know it's populated correctly. I think I'm just missing something small.
View Replies !
Table Insert
i design a form that post some value to same php page, and i write some code in the page which is responsible for insert the values into database table, i use if submit = 'add' to execute that part of code. thats works nice but when i reload(using browser reload button)the page everytime it insert the same value to the database again and again. is there any good way to prevent this?
View Replies !
Insert A Table
How to insert a table like this with a <table width="100%" border="0" cellspacing="0" cellpadding="0"> i would like to put the text to the right to the website screenshot.
View Replies !
Insert Into More Than One Table
What's the best way to write a SQL statement so it will insert data from a form into more than one table? For example, I'd like to be able to do something like: PHP Code: $sql = "INSERT INTO attendees SET firstName='$firstName', lastName='$lastName', typeOfAttendeeID=Ƈ', conventionID=Ƈ'"; and simultaneously do this: PHP Code: "INSERT INTO relationships SET role='father', typeOfAttendeeID=Ƈ', conventionID=Ƈ'";
View Replies !
Insert At Specified Row Of Table
I've checked my reference books, and many sites including this one, and can't find a way to insert a row at the location I choose. I don't want it in alphabetical order, or anything, but I do want to control where the data can be placed.
View Replies !
Insert Into TABLE
here is my code: if ($_POST['submit']) { mysql_pconnect('localhost', 'root', ''); mysql_select_db('test'); $result = mysql_query("SELECT * FROM customer"); $col = mysql_num_fields($result); for ($j=0;$j<$col;$j++) { $info = array(mysql_field_name($result,$j)); mysql_query("INSERT INTO customer (".$info[Ɔ'].") VALUES ('".$_POST[$j]."')"); } echo "<meta http-equiv=REFRESH content=0;url=http://".$_SERVER['HTTP_HOST'].">"; } else { echo "<form method=post action=".$PHP_SELF.">"; .........
View Replies !
Simply Send An Email When A User Registers
i m trying to simply send an email when a user registers, and i used the mail function and i got the error "Warning: mail(): SMTP server response: 550 5.7.1 Unable to relay for m@hotmail.com in C:Extrndxmail.php on line 2" and i have no clue what is wrong?
View Replies !
Insert Into Table Using For Loop
i managed to get bits a pieces and managed to get this script to nearly work. I put together this script which a)gets a no. of fields to create 2) creates those fields 3) on submission it checks for blank fields & may display error msg 4) also it checks in the db for duplicates & may display error msg 5) if all good it submits to db. Here comes my dilemma. 1, 2, 3 and 4 work fine however the final part 5 doesnt work at all. 5 works if 3 and 4 are taken away for some reason. I am sure there i am missing something. Can someone please take on the challenge and direct me to where i could be going wrong. PHP Code:
View Replies !
MS Access And Php- Insert Row In A Table
I am not able to insert a row through a form in my database which is in Access.Please see my code below and help..Select works O.K. but inserting through form is a problem.This is form1.php.here I am inserting the values.This form has action process.php......
View Replies !
Insert Data To A Table
I just can't figure out why it isn't sending the data to the table, I've check the names over and over, all the info is parsed correctly, but it falls flat at: $result = mysql_query($sql);
View Replies !
Mulitiple Table Insert
I have a table that when you add a new department it will add the name to the table and assign the row and id based on an auto_increment column. From there you need to get the value of the last insert id. SO what I did was use the msql_insert_is() function. and assigned it to a variable. I then used that variable in my next query because this vaule is a forigen key in another table. Here is my code it should be exectued if you where to post this page with the value of $department_id = "" then the section of script in question will execture. Essentially need it to grab this id number and then place it into 2 more insert statements that should execute immediately after the first insert statement. Then only insert id that I would need is the one produced in the first insert statement what an auto increment value is assigned to the same table as the department_name Code:
View Replies !
Insert To One Table, Update To Another
I'm trying to do two queries at once utilizing data from a form. I'm creating a new row in one table, and I need to reflect the ID number and other supplementary data to an existing record in another table. Is there a way to string two queries together so they execute at the same time? Here's what I've been trying so far: Code:
View Replies !
Multiple Table Insert
The $IDNumber variable falls in an auto_increment column. However, nothing is being inserted into the 'General' table, and 'Notes' is inserted into the 'IncNotes' table, but it is coupled with a blank value for the IDNumber. Code:
View Replies !
Insert Data To Table
i have a user(members) form that pulls from my database 3 fields: name, age, about. i want the user to be able to edit their info then re-submit back to the database. however, i want to have some control as to what they edit their info to. so instead of just update the info back to the database. i want to hve any fileds that have 'changed' by the user get put to a different table(review), so after i have approved the changes i will 'update the master user table. is there a logical way that i could do this, i guess just flag any fields that have changed when the user form is submitted.
View Replies !
AJAX - Insert Table Row
I basically want to fire off an AJAX request to the server (on a form POST) which will run a php function and return a New Table Row to the original requesting page in TABLE 1, Remove a Table row on the original page TABLE 2, without refreshing the entire page contents. Can anyone point me to some simple examples?
View Replies !
Insert Into New Table And Delete From Old
I've got 2 tables of users: 'pending' and 'approved'. The first table (pending) is a 'holding' table for unapproved users and when the user is approved I can click on a checkbox by their name and copy them over to the approved users table (INSERT INTO approved...) This all works fine but I'd also like to delete them from the 'pending' table at the same time. How would I do this? Something like (INSERT INTO approved, DELETE FROM pending)? I'd do a bit of trial and error but since it's on a live site, I don't want to muck it up and not be able to fix it! Code:
View Replies !
Insert Integers Into Table
I'm making a relational database for tagging, I'm coping the structure from a wordpress database I saw once. Everything works but mysql_query for linking some ids together. My syntax is correct as far as it can be, still it throws this error: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in myscript.php on line 60 Failed Query of INSERT INTO `one2other` ( `rel_id` , `one_id` , `other_id` ) VALUES ( NULL , ƈ', Ƈ' ); rel_id is the primary key. I'm using a function that does the insert and works with other tables. The only difference I find from this particular table (one2other) is that phpMyAdmin's Row Statistics tell me that format is 'fixed' while all the others is 'dynamic'.
View Replies !
Insert Data Into A Table
PHP Code: <?php $connection = mysql_connect("localhost", "******", "******"); if (!$connection) { die('Could not connect: ' . mysql_error()); } mysql_select_db("trickyph_testdb1", $connection) or die('Could not select DB.'); $query = "INSERT INTO users (FirsName, LastName, Address, City) VALUES ('Jimmy', 'Watts', 騼 Wolfer Ln.', 'Springston')"; mysql_query($query, $connection); mysql_close($connection); ?>
View Replies !
Insert Entries Into New Table
Is there a way I can select data from one table and enter that data into another table by descending order of one of colums from table one? Basically table one is a list of players with scores and I want to create a league table in a seperate table where the first row is the player with the highest score.
View Replies !
Set Up The Permissions So That My Script Can Simply Fopen A File For Writing.
I am rather new to PHP and a relative newbie to Linux too. I have a webserver at home (Apache 2.0.48 on SuSe 9.0, PHP4). I have some scripts, one of them needs to be able to create logfiles somewhere on my machine. It must also later be able to read from and write to these files again. Sofar I get a permission error. I tried chmodding 666 or 777 the directory in which the files could reside, to no avail. How do I set up the permissions so that my script can simply fopen a file for writing. Or if that's not the issue, what am I doing wrong or overlooking ? The errors: Warning: fopen(logfileslog1.txt): failed to open stream: Permission denied in script1.php on line 142 Warning: fwrite(): supplied argument is not a valid stream resource in script1.php on line 154 Warning: fclose(): supplied argument is not a valid stream resource in script1.php on line 161 It's the first I am puzzled about, the 2nd and 3rd are a logical consequence. By the way, reading from and writing to a file I have previously created myself with exactly the names I tried to get created by the script (echoed the name, ok) is no problem at all. So I don't think it has much to do with a safemode or open_basedir setting. I also tried creating the scripts in the same dir the script itself resides. Did not work either.
View Replies !
Insert Into Table Via Assoc Array
I am trying to populate data from an array into a table, but i cant figure out what i am doing wrong. //mysql query $sql = "SELECT charge_location.dept_code, charge_location.week, Sum(charge_location.total_hrs_paid) AS sum_of_total_hrs_paid, Sum(charge_location.hrs_non_chargeable) AS sum_of_hrs_non_chargeable FROM charge_location GROUP BY charge_location.dept_code, charge_location.week"; $result = mysql_query($sql); $num_results = mysql_num_rows($result); //populate the stats_table for($i=0; $i<$num_results; $i++){ $row = mysql_fetch_array($result); mysql_query("insert into stats_summary values( ($row[dept_code]), ($row[week]), ($row[sum_of_total_hrs_paid]), ($row[sum_of_hrs_non_chargeable])) "); } PS i get no errors when it executes, just fails to populate the table.
View Replies !
Using An Array To Insert Data Into A Table.
This works: $col1 = 2; $col2 = 2; $col3 = 2; $col4 = 2; $query = "INSERT INTO test (a,b,c,d) VALUES ($col1,$col2,$col3,$col4)"; and this does not $col = array(2,2,2,2); $query = "INSERT INTO test (a,b,c,d) VALUES ($col)";
View Replies !
How Do You Insert A Value From Drop Down List To SQL Table?
I am a bit new to PHP and SQL so this may seem like a dumb question. I have already created a drop down list as part of a form which is automatically populated with values taken from a separate database. When a user goes onto this page and either leaves the default value or selects a value from the drop down list and presses the submit button, I would like that selected value to be stored into a database which I have already created in SQL. Just to let you know that I can do the above using a text field but just don't know how to do it with drop down list. If your going to explain any coding then it may help if I give you the names of certain items that are involved. Database is called "Company" Field within database is called "Name"
View Replies !
Multiple Table Insert With Php Mysql
I am having and issue getting this code working. It seems rather simple but I cannot figure out why only one sql statement is exectuing and the insert statements the other 2 are not exectuting and updating the other 2 tables. I need to do this. I need to update one table, then from that I need to retrieve the mysql_insert_id or just get the id of the last record in the tabe. There is an auto increment column that gets assigned a unique id each time a record is inserted. I need this id number then I need it to place data into 2 other tables that will use this value as a reference. here is the code:
View Replies !
Won´t Insert Any Field In A Table
I´ve been wandering most of the night trying to find what i did wrong but couldn´t find and answer. Here is what happens: im using a function called "cargar_horas" that should insert 6 values in a table, but for some reason the query is not working. I echoed most of my code to check the values of my variables and they are fine. I think it must be something beyond my knowledge, so i hope someone can figure out what is this. Code:
View Replies !
Insert Multiple Records In Table
I want to use a form to insert multiple records into a table. I have an book club where a person would rank a book (3 to 1) next to a particular book read for a particular month. 3 being the most favorite book read that month and 1 being least favorite. Below is the table the records would be inserted into. Key----Month--------Reader---------Rank-------Book 1-------January-------Jim--------------3----------Bible 2-------January---------Jim-------------2----------Koran 3-------January---------Jim-------------1-----------Torah How can I have a form where the reader sees only (and fills in) the rank and book text fields, and the Key, Month, and Reader fields are filled in behind the scenes with the default info when the form is submitted .
View Replies !
Mysql_query - Insert Data Into A Table
I have the following code to insert data into a table. Why doesn't it work? $db=mysql_connect("mysite.com","username","pw"); mysql_select_db("site_log",$db); $query="INSERT INTO logs (ipaddress,sid,cid,vid) VALUES ($ipaddress,$sid,$cid,$vid)"; mysql_query($query);
View Replies !
Insert Several New Fields Into Mysql Table At Once
I'd like to create 300 new fields in a mysql table but I don't want to type them out by hand. Could anyone tell me some MySQL syntax to autmate part of this please? CREATE TABLE questions (q1 VARCHAR(25), q2 VARCHAR(25), q3 VARCHAR(15)) all the way up to q300 Any suggestions?
View Replies !
INSERT, UPDATE Into A Memory Table?
Just created a MySQL table in the memory (memory storage engine) but im having problems adding information to it... First of all it is complaining every time i try to auto increment the primery key.... then it is not adding anything when I use a standard insert into the table (it has no auto inc. now....).
View Replies !
|