Insert Into One List Box
I have two tables data. After querying it I have two results. I should insert into one list box where data from table A i should color it in font black and another in red and disable it(from table B).
View Complete Forum Thread with Replies
Related Forum Messages:
Insert From An Drop-down List
i have a table in wich i've inserted city's name.then i have an registration form in wich i want to display an dropdown list with the cities from the table, and if one city is selected to be automaticly added in the second table. how can i do that?
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 !
INSERT INTO - Enters List In Reverse
I have a function that creates a list of IP address and enters them into a table. Most of the enteries are poopulated with enteries from a file with the LOAD data infile command. These are entered into the DB in ascending order. The below function enters the information info the table, but my problem in that it's entered in reverse order. Code:
View Replies !
Dropdown List - Insert Into Mysql
I simply want to add a dropdown list where, when an option is selected, its value will be inserted into a dbase table. More specifically, asume there is a page where the user sees his order. He will be able to select the order status (pending or delivered). So, for example, if his ordered is deleivered, by selecting "delivered" option, "delivered" will be inserted into the 'Status' column. Code:
View Replies !
List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that: - reads in all the files in a particular directory - displays the file names in a html list and makes a link of them: <ul> <li><a href="filelocation1">filename 1</li> <li><a href="filelocation2">filename 1</li> <li><a href="filelocation3">filename 1</li> </ul> etc.? So basically it creates a list of links with the contents in that directory, so you can download them from there.
View Replies !
Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not. What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings. SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = Ƈ') ORDER BY msgno DESC LIMIT 100 What I'm getting, though is a list that looks like this: mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary. If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1. mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 2214 msgno: 0412141622 msglist: 1 mbxno: 2189 msgno: 0412141408 msglist: 1 mbxno: 0000 msgno: 0412141213 msglist: 1 mbxno: 0003 msgno: 0412141213 msglist: 1 mbxno: 2265 msgno: 0412132029 msglist: 1 mbxno: 0000 msgno: 0412131950 msglist: 1 How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?
View Replies !
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 !
Mailing List Manager, Send To List
I'm looking for a mailing list script (php) that has a function to let users to reach out to all recipient on the list by simple send the email to a specific maillist- address. Mailman has this functionn but as a just got a webserver account I can't use mailman nor install it.
View Replies !
Insert Statement Doesn't Insert Anything
I have an int field in a database and for teh purposes of this case the insert statement doesn't insert anything into the field using the ' ' syntax however in the mysql database this appears as 0. I was wondering can I still use the empty syntax as follows or will it not work as it is 0 does is this not classed as empty? if (empty($row['intTest'])){ $sns= "empty"; }
View Replies !
List Dir / List Files
Is there a fast way to read files/directory recursively? Instead of inspecting each file(s)/dir(s), is there a way to know that its a file or a directory from its hidden attribut both for windows or unix filesystem?
View Replies !
List To Populate Another List
i have a form with 3 dropdown list. the first is for a canditate, 2nd is for party, 3rd is for state and 4th is for the local areas in the state. I want if the user selects a state, the dropdown list for the local area to be populated automatically. But since they are on the same form i am not sure how.here is my code <td><select name="state" tabindex="3"> <?php #this is to get listing for roles in a drop dowm menu #the sql query $sql1 = "SELECT distinct(state_name) FROM state order by state_name "; #execute query $rs1 = mysql_query($sql1, $myConn) or die ("could not execute query $sql"); if ($rs1){ while ($row1 = mysql_fetch_array ($rs1)){ echo("<option>" . $row1['state_name'] . "</option>"); } } ......................
View Replies !
Sql Insert
I have looked at numerous examples of SQL insert statements with PHP and this apparently should work: $sql = "insert into estateagents (companyName) values ('$companyName')"; but it does not - it tells me a record has been added....but nothing appears in the db...any ideas?
View Replies !
Insert (now(),now(),....)
I've a query with insert records in a table. I've 2 fields: DateTimeInsertion and DateTimeLastModification. When I create the record, I must have those 2 fields set the same value. Now I've this Insert into article values(now(), now(),....) but what appens if the time changes between the 2 now calls ? It's there any way to be sure to set the same value ?
View Replies !
No Insert ...
I have a php-script with a mysql_query ... $insert = mysql_query("INSERT INTO $table (textID,redaktion) VALUES ('$_POST[ID]','$row_startseiten[ID]')"); I get no mysql_error, if i copy the insert directly into phpmyadmin, the insert works. but with the php-script the insert doesn`t create a new row in the table .. but why?
View Replies !
INSERT INTO DB
All of the variables are registered with the session and I see them when I do a test. Knowing that I now wish to use the code below to insert them into the DB. But it doesn't work! When I run the script it appears to work but the DB does not get updated. Code:
View Replies !
PHP Insert
Im having a problem with a subscription script I made. Its a basic script, and the purpose of it is to allow a user to enter their email address, forename, surname, and select weather they are a business user or home user, then click "submit" and the information gets entered into the database/table I made for the script. Now the problem Im having is the script works, and it submits, the problem is if I go look in the database the script didn't actually insert any information into the database. Below I have included the html form, and the handle.php (the php script that handles the form information) I was hoping someone may be able to provide some insight/advice as to why its not inserting whats in the field values into the database Code:
View Replies !
Insert And Get Key
I have a problem. I am inserting a record in a database that when inserted will redirect to another page. I need that auto incriment key that was generated on that redirect page. How can I do this?
View Replies !
Insert Tag
I'd like to insert a <BR> tag after every X number of characters. Anyone know how I can do that?
View Replies !
10K + Row Insert
I have an approximately 10,000 Plus records (each record = 1 row) that I need to INSERT into a REMOTE (TCP) mysql database... using a While loop obviously takes way to long... Any other suggestions? Can I create a single Mysql command with 10,000 inserts in it?
View Replies !
The Insert
the script im working on is not putting the right info in the database it should put the username and userid of the person that i click on but it is inserting readom usernames and userid here the script i have <? include'db.php'; include'userinfo.php'; include'admin_c.php'; include'admin_info.php'; if($_GET['add'] == "admin2") { //Create User In Database $INSERT=mysql_query("INSERT INTO `admin`(userid,username) VALUES ('$userid', '$username')")or die(mysql_error()); }else{ if($_GET['add'] == "admin") { include'all_users.php'; }else{ if($level==5){ echo"5"; }else{
View Replies !
I Insert To 3
i have a date text field..for example user insert value བ/09/2005'. i want that data insert in 3 field in table. 26 insert in field day, 09 insert in field month and 2005 insert in field year. How to to this?
View Replies !
INSERT INTO
This Doesn't work. code: $result = mysql_query ("INSERT INTO Reservations VALUES ('$records','$resName', '$resEmail', '$resGuests', '$resGuest1', '$resGuest2', '$resGuest3', '$resGuest4', '$resDiet', '$resAttend');", $connection); But this does: $result = mysql_query ("INSERT INTO Reservations VALUES (20,'Joe', 'none', 1, 'none', 'none', 'none', 'none', 'none', 'Yes');", $connection);
View Replies !
Insert?
i want to delete some data by checked the checkbox and at the sametime i want to insert the data into another table(like want to backup the deleted data)..have any idea? Code:
View Replies !
Insert
INSERT INTO Frequency( Search, DateAdded ) VALUES SELECT Search, DateAdded FROM Searches I get this error #1064 - 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 'SELECT Search, DateAdded FROM Searches' at line 4
View Replies !
Insert 2 At 2
i have an array like this array(a,b,c,d) and I want to insert in the mysql database like this: a a b b etc how can i do this.
View Replies !
How To Insert
I have written a PHP script named dynamic.php. It runs fine by itself, I have been trying to insert it into a index.htm, the site root page. For some reason the code does not get parsed, what am I doing wrong?
View Replies !
Db Insert Now()
All its adding is 0000-00-00 00:00:00 but when its updated it works correctly (ex. 2006-09-15 01:14:29). So my question is how can I modify my insert code to work correctly with now()). It took me long enough to make insert work to begin with since it was barking at T_String, T_integer and so on. So heres the code for update and insert. So to make it clear, im looking to make NOW()) work correctly in the insert code. PHP Code: $info["client"] ."','now()')") or die(mysql_error());; (mysql_affected_rows() != -1) or die ("ERROR: ". mysql_error()); ?>
View Replies !
Insert </tr><tr>
There is an uncertain number of pictures that need to be displayed reverse (new ones before old ones) 4 in a row. And after every 4 loops the script must insert </tr><tr> until the loop come to an end (0). I decided to move this way: Â $rows=mysql_num_rows($cmd_rows); // THAT NUMBER OF PICTURES Â echo '<table><tr>'; Â Â for ($view=$rows-1;$view>=0;$view--) { Â Â if ($view%4==0) { echo '</tr><tr>';} Â echo ' <td>//PIECE OF CODE //</td> '; Â Â Â } echo '</tr></table>';
View Replies !
Insert Into The Db
I want to upload a text file (or open/read one already uploaded on the server) and take it's contents and insert it into the database. The format of the text file is: Miami 31, Marshall 3 Northern Colorado 6, Hawaii 63 I usually have 100+ games a week in a text file. These four fields should be entered into the team1_name, team1_score, team2_name, and team2_score fields of the database table. I've dealt before with fopen and fputs, but really haven't dealt with opening/reading a text file and taking it's contents into the database.
View Replies !
Using Insert Into Where
From the sql manual it looks right. It seems to get caught up only when I include the last part with the userid and password (The WHERE statement). $sql = "INSERT INTO client SET compname = '$_POST[compname]', web = '$_POST[web]', email = '$_POST[email]', cat = '$_POST[cat]', recip = '$_POST[recip]', description = '$_POST[description]', state = '$_POST[state]', city = '$_POST[city]' WHERE userid = '$_SESSION[userid]' AND password = '$_SESSION[password]'";
View Replies !
Get ID Right After Insert...
I have the following INSERT command in my code, what I'd like to do is get the ID it is assigned below it. $add_story_rs = $conn->Execute ( "INSERT INTO story(story_content, story_date) VALUES('" . $_POST['story_content'] . "', NOW())" ) or die ( $conn->ErrorMsg() ); $story_id = $ID; // This is where I'd like to get the ID for the story just added
View Replies !
Using List
when my form is loaded i populate a list with a database query. now when user selects a value from the list. on "onChange" another query runs and other fields on the form are populated according to the value selected by the user but at this time when page is loaded again and the fields on the form are filld. every thing goes write but the select list doesn't have the same value selected that was selected by the user...the selected list shows the default valuse selected instead. i want to know that how can we do this that when we select a value from the list and page is populated using this vale and refreshed then again i want to see the selected value in the list box not the dafault value.
View Replies !
Mp3 List
I can't figure why I can't list only mp3 files with this code : <?php $dir = opendir("."); while($file = readdir($dir)) { $ext = getFileExtension($file); if ($ext = "mp3") { echo "<a href=" .$file.">".$file; echo "<p>"; } } closedir($dir); function getFileExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } ?>
View Replies !
Mp3 XML List
I have an mp3 player for my site. Now I still have to make an upload script but I am wondering something. How would I go about making the scritp write the needed information to the playlist.xml file? So for instance a member uploads a file called "Cowboys_from_hell.mp3" how would I insert this info to the play list? <track> <title>Cowboys From Hell</title> <creator>Pantera</creator> <location>cowboys_from_hell.mp3</location> </track> The tags are already in the playlist so I just need to insert the data between the tags. I have never done anything with xml or saving info to files so this is new to me. Maybe this is even a db thing to, i dont know. if it helps any i am using the jw_mp3_player.
View Replies !
List Box
i know its possible using php to create a list box populated from a database and this i have done in the past. What i want to do now is: I have records that have colour options in a single field seperated by a comma eg red,yellow,green,blue What i want to do is add each of those colours into a list box using php pulling that data from the db. These colours are different for each record in the db and are all in one field. Is this doable?
View Replies !
Get Tag List
I want to creat Tag list shown in below web site. http://www.technorati.com/tags/ Can anybody tell me how to write code for this.
View Replies !
Php List
Code: function showlist() { global $db_table_files, $db_files_link_url, $db_files_link_total, $db_files_link_date, $db_files_id; $result=mysql_query("SELECT * FROM `$db_table_files` order by '$db_files_link_date' desc limit 10 "); echo mysql_error();
View Replies !
Get Dir List
Code: <?php $real_path = realpath("test/"); $d = dir($real_path); while (false !== ($entry = $d->read())) { if($entry != "." && $entry != "..") { echo "<a href="$entry">$entry</a> "; } } $d->close();
View Replies !
List()
I have a question about the list() function that I could not find on php.net; I am using the following code: PHP Code: $query = "SELECT blog_id, title, entry, DATE_FORMAT(date_entered, '%M %e, %Y') AS formatted_date                                   FROM blog_entries ORDER BY blog_id DESC LIMIT 3";                         if ($r = mysql_query ($query))  // Run the query.                         {                             // Retrieve and print every record.                             while ($row = mysql_fetch_array ($r))                             {list($id, $title, $entry, $date) = $row;                                 //$date = date("F d, Y");                                 $title      = htmlspecialchars($title);                                 $title2     = trim(strtolower(str_replace(' ', '-', $title)));                                 $entry      = nl2br($entry);                                 $cut        = substr($entry, 0, 300);                                 $new_text   = substr($cut, 0, strrpos($cut, ' '));                                 echo "<h2>{$title}</h2>{$date}<br />
View Replies !
Insert Into MYSQL Using PHP
I'm having problems with a form I've created to insert or update into a MySQL database using PHP. The fields (some are varchar and some are text) sometimes contain single or double quotes or slashes or '¿' and some other special characters. These seem to throw off the INSERT process in one way or another. Either that or when I got to display this information, it doesn't come out right. Are there functions that I need to run on the information to make this database safe before I INSERT (or UPDATE) or before I display it?
View Replies !
INSERT With OCIBindByName Or Not? What Is Better?
I was wondering. What is better? INSERT a value with the OCIBindByName function like this: $connection = //connect to database $sql = "INSERT INTO <tablename> (column) values (:new_value)"; $stmt = OCIParse($connection,$sql) or die ("whatever"); OCIBindByName($stmt, ":new_value", &$variable, 20); OCIExecute($stmt); OCICommit($connection); OCIFreeStatement($stmt); Databasedisconnect($connection); //my own function to disconnect the database OR VIA THIS WAY (which I prefer by the way, because the code is shorter) $sql = "INSERT INTO <tablename> (column) values ($variable)"; $stmt = OCIParse($connection,$sql) or die ("error during parsing"); OCIExecute($stmt) or die ("error during execute"); OCICommit($connection); OCIFreeStatement($stmt); Databasedisconnect($connection); //my own function to disconnect the database I hope someone can tell me which one the methods above is better/faster/more efficient.
View Replies !
Redirect After INSERT
I have taken old Dreamweaver INSERT record code and turned it into a generic function. Basically another function generates the SQL and this one inserts it. The INSERT works great but I then want the page to redirect back to the index.php page and this is not working at all. Does anyone know the best way to do this. The code is below: The form action is below: <form action="<?php insertSQL($c13_db, $add_competition);?>" method="POST"> This is the insert function: function insertSQL($_db, $sql) { $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["form_submit"])) && ($_POST["form_submit"] == 1)) { $sql = get_sql($sql); $result = mysql_query($sql, $_db) or die(mysql_error()); $insertGoTo = "index.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?'))? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } } The header function is left over from the old Dreamweaver code and I cannot get it to work now it's within a function. Can anyone please help me out.
View Replies !
Insert Ignore
Are you allowed to use the following syntax in Mysql 4.0.17-nt : INSERT DELAYED IGNORE INTO `mytable` ( `ID` , `A` , `B` ) VALUES ("'.session_id().'", "2", ROUND(NOW()/10000) ); I am particularly interested in the delayed ignore. I want to make sure that no matter what, the instruction is carried out and that, due to indexes, the data is not allowed to go in, that we do not get an error.
View Replies !
Insert File-name Into Db
I have an html-form with 3 fields, 2 simple textfields and one file-field. I want to store the information in an mySql-table. The two text-fields are easy-ones, $_POST[text1], $_POST[text2], but how do I get the value from the file-field? $_POST[file] does not do it for me... I just want to store the name of the file in the table, pic/article1.jpg, for example.
View Replies !
PHP-MySQL Insert
$Insert_query = mysql_db_query( "INSERT INTO $Table_result VALUES('$Item_Name', $Item_Price)" ); Why do I get a parse error on this line of code???
View Replies !
PostGreSQL INSERT
I've written some scripts to display information from a PostGreSQL database in a table format, and everything is fine. I've been adding data manually up until now. So, I've written a page where users input their information and this gets inserted into the relevant table. However, this isn't working. I have been chopping code out to the bare minimum just to get something working, but even the simplest thing doesn't work.Here's what I've got at the moment : $resultSet = pg_exec($conn, "INSERT INTO ntable (make, model) VALUES ('Suzuki', 'Bandit'))"; I have connected ok, so there's no problem there, but the above line produces : Parse error: parse error in /web/sites/042/grendel/www.grendel.f2s.com/addins.php3 on line 39 .
View Replies !
|