|
|
oh...i never knew that. thanks for the update cjoki
|
|
|
|
|
Better remove question icon from your post and add some text in title specifying that this is not a question, since this forum is generally used to ask and answer programming questions.
|
|
|
|
|
Hi am back again after weeks of trying to populate multiple combo box from a mysql database.
I have a script that loads one combo box / drop down list well by populating car make.
The lists are supposed to be first "car make" then second "car model" third "car badge" fourth is "car description"
the code at present is
<?php
include("../includes/store.php");
$query = "SELECT make FROM cars";
$result = mysql_query($query) or die(mysql_error());
echo "Make";
$dropdown = "<select name='make'>";
while ($row = mysql_fetch_assoc($result))
{
$dropdown .= "\r\n<option value='{$row['make']}'>{$row['make']}</option>";
}
$dropdown .= "\r\n</select>";
echo $dropdown;
echo "<br>" . "<br>";
$query1 = "SELECT model FROM carmodel WHERE makeid = {$row['id']}";
$carmodel = mysql_query($query1) or die(mysql_error());
echo "Model";
$list2 = "<select name='model'>";
while ($row = mysql_fetch_assoc($carmodel))
{
$list2 .= "\r\n<option value='{$row['model']}'>{$row['model']}</option>";
}
$list2 .= "\r\n</select>";
echo $list2;
?>
The database table are
table 1 cars = "carid" & "make"
table 2 carmodel = "modelid" & "makeid" & "model"
table 3 badge = "badgeid" & "modelid" & "badge"
table 4 cardesc = "descid" & "badgeid" & "yearofman" & "transmission" & "drivetype" & "fueltype"
I can populate the first dropdown list but how to get the second drop down to populate with the car model records based on the selected car make
then the cars badge of the filtered car model the description is proving to be a pickle. Please help as after days of searching and playing with code
cant seem to nail it right.
Thanks in advance.
|
|
|
|
|
I'm affraid your page logic is off slightly. Your sublist (model) should be dependant on your primary list (cars). Which would mean that on a selection change on the client's end you either need to load the sub list from the server using Ajax or you need to prepare multiple sub selects and display the one belonging to the cars that is selected.
If you opt for the first alternative you will need to create a seperate php file that will provide you the options for the 'model' select. You should then call this page on the 'onchange' event of the 'make' select using Ajax and fill the 'make' select.
If you opt for the second alternative you will have to generate an option list for each of the various 'make' possibilities and store them in either invisible select elements or in JavaScript array's. Eg:
$query1 = "SELECT model FROM carmodel ORDER BY makeid";
$carmodel = mysql_query($query1) or die(mysql_error());
$last_make = -1;
$list2 = "<select name='model'>";
while ($row = mysql_fetch_assoc($carmodel))
{
if ( $last_make != $row['makeid'] ) {
if ($list2 != '') $list .= "</select>";
$list2 .= "<select name='model_{$row['makeid']}' style='display: none;'>";
$last_make = $row['makeid'];
}
$list2 .= "\r\n<option value='{$row['model']}'>{$row['model']}</option>";
}
$list2 .= "\r\n</select>";
echo $list2;
Please note I've not tested the code so it might contain some mistakes, but the overall logic should be clear.
|
|
|
|
|
Hi Dears
I need use an array that accessible from each users session
in fact this array must resident in memory
pleas help me...
|
|
|
|
|
This sounds like it would be better handled via a table. Is there a specific need for an array?
|
|
|
|
|
a Table?
Do you mean there is a table in the database?
For some reason I can not I use the database
in fact a robot call and send information to a url Several hundred times a second At different times
i need this information but the MySql Speed is lower than robot calling and Mysql Pass throw an thread Error
The best solution is to store data in memory And then we save data with 'BatchInsert' in MySql
But!! do not know how i can stored the information in memory
this technology in ASP.net is Application Variables
Pleas Help Me !!!
modified on Thursday, January 6, 2011 9:15 AM
|
|
|
|
|
I would look into memory tables http://dev.mysql.com/doc/refman/5.0/en/memory-storage-engine.html[^] as an alternative as it will give you speed and sql access. That is if you can use a mysql database since it sounds like you have some issue with any db access or was it just the speed issue?
As an alternative you can use two arrays in a double buffer kind of configuration. You will need to write some code to flip between them so as one array fills up a certain amount of data, say 10000 records, you switch to the second array for input and you can write the first arrays data to a database and then clear it out. Then when then the second array is filled switch input to the first and insert the second arays data to a database. Just keep repeating this switching, dumping and inserting while the script runs.
One issue that jumps to mind is going to be script execution time. How long is this script meant to run?
Another would be with hanging the PHP engine with a single thread of execution. In this issue you may be able to read up on making a multi-threaded php script. here is one article on it that I found with a quick google search... http://phpmultithreaddaemon.blogspot.com/[^]
Hope that helps
|
|
|
|
|
Hi,
I am sending a HTTP post request to external url and if it is successfull - the client server returns OK:12345 on web page.
Now 12345 is an id and this is what i need to capture and store it as a variable to be used in my second script. Is there any way i can save this id as a variable or something.
Thank You.
|
|
|
|
|
Sounds like cross site scripting which is a security issue and you will find hard to work around. You can use something like cURL to do it though.
|
|
|
|
|
I agree with cjoki that this is cross site scripting. It's a pretty big security vulnerability to do such things and a lot of browsers (or security software/addons) will attempt to block it.
However, do you have control over the 2nd server (i.e. can you set it up to send that id as a post back to your server?) If so I'd recommend doing that if you absolutely have to. If the OK:##### is just generated HTML I'm not sure how you would go about capturing that and storing it as a variable.
|
|
|
|
|
ok how about if the client side send a data via post to our site -
On that page i have written a script to store post data in a text file. But this works internally when i try to send data via post method to that page but not externally.
|
|
|
|
|
hi, i have created a member log in system which will change a page which is included on the homepage....
Ok, now when i log out it destroys the session fine but then i get this error
"Notice: Undefined index: logged in ttab.php on line 4",
how do i get rid of the error because on other pages it seems to go away ...
Code for file which displays depending on session ... (ttab.php)
<html><style>div{font-family:Arial;}</style><body>
<?php
session_start();
if (!($_SESSION['logged']== true))
{
echo"<a href='memlogin.php?msg=0' id='flink'><div>Register/Log In</div></a>";
}else{
$name = $_SESSION['user'];
echo"Welcome $name,  <a href='account.php' id='flink'>Account Options</a> | <a href='ref/logout.php'id='flink'>Log Out</a>";
}
?>
</body></html>
Process that the log out does ... (logout.php)
session_start();
session_destroy();
header("location: ../index.php");
|
|
|
|
|
The "undefined index" message is telling you that there is no value with the key 'logged' in $_SESSION .
Try changing your test to this:
if (!(isset($_SESSION['logged']) && $_SESSION['logged']== true))
The isset call will short-circuit the test if the 'logged' key is not found.
|
|
|
|
|
I'm new to PHP so please excuse my ignorance here. I'm in the process of learning PHP on my own and need to get a new book (only have one on PHP 3 ). What I'm looking for is how to pass "variables to pages" I think? From what I can tell in my limited exp this is possible just not sure what it's called. For example in a URL you may see something like CalDateMonth=12 or something similar to that, don't have a exact example at the moment. So when I look for a new book I'd like to be sure this is covered, just don't know what it is I'm looking for to be covered
Thanks in advance!
|
|
|
|
|
That's the $_GET-function.
Have a look here, it's pretty simple: PHP $_GET Function[^]
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
Exactly what I was looking for, thank you!
|
|
|
|
|
Welcome.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
Which should be the best PHP Webmail system to access my mail remotely to meet such requirements?
- Outlook Synchronization
- HTML email composing
- IMAP support, including IMAP over SSL
- Live Spell Check
Roundcube Webmail, AfterLogic WebMail, AtMail, SquirrelMail, Which one should be the exact one I am looking for?
Thx
Wallace
|
|
|
|
|
SquirrelMail will out of the box not fit the spell checking nor HTML format I believe, RoundCube does everything you want. I personally don't know the other two. Except for one thing, which is Outlook synchronization. What do you mean by this (mail sync, calendar), Outlook consists out of several features.
If you are solely focusing on the mail part for Outlook then the PHP webclient is not an issue as Outlook will connect to the IMAP server itself, just like the webmail client.
|
|
|
|
|
If you are looking for a web based email client, then try roundcube. It has some pretty good features. On the other hand if you are looking for a email client application that runs on the desktop, try Mozilla Thunderbird. It will connect to any mail client which supports IMAP and POP3. Also it is free.
|
|
|
|
|
Hi,
I need to pass csv file data using special multiple part form post to client system -
The example they gave is -
POST /interface/list_upload_data.php HTTP/1.1
Host: response.pure360.com
User-Agent: www.xyz.com upload process
Accept: text/plain
Accept-Language: en
Accept-Encoding: gzip
Accept-Charset: ISO-8859-1
Keep-Alive: 3600
Connection: keep-alive
Referer: http:
Content-Type: multipart/form-data; boundary=---------------------------
25578952812662351891242608872
Content-Length: 516
-----------------------------25578952812662351891242608872
Content-Disposition: form-data; name="profileName";
myProfile
-----------------------------25578952812662351891242608872
Content-Disposition: form-data; name="123456789"; filename="listData.csv"
Content-Type: text/plain
john.smith@email.com,John Smith,07798564352,Brighton
sarah.jones@email.com,Sarah Jones,0779646352,London
bob.samuel@email.com,Bob Samuel,0775354542,Cardiff
-----------------------------25578952812662351891242608872--
I can see few others had problem implementing this at this site - http://forums.asp.net/p/1449713/3305985.aspx[^]
Any ideas how can i achieve above task using php ?
Thanks
|
|
|
|
|
--- This looks alot like how an email is formated.
Content-Type: multipart/form-data; boundary=---------------------------25578952812662351891242608872
-- You will have to be read to detremine how the document is seperated and ends.
boundary= is the key
---------------------------25578952812662351891242608872 is the value.
-- Each record boundary value may have a random value or is hard coded, reguardless you will need to read it as it will seperate the documents various sections.
Content-Disposition: form-data; name="123456789"; filename="listData.csv"
Content-Type: text/plain
-- This looks like the header to the data.
john.smith@email.com,John Smith,07798564352,Brightonsarah.jones@email.com,Sarah Jones,0779646352,Londonbob.samuel@email.com,Bob Samuel,0775354542,Cardiff
-- and of course this is the data. As a csv file goes it is missing the first line which the column names but you can work around that.
-- I would save the entire post as a text file and then open that with the file function which will return an array.
-- You can then step through the file looking for the Content-Type: text/plain and then move to the next row as this is where the content data starts.
-- Then use the explode function to make a array of the individual lines of data...
john.smith@email.com,John Smith,07798564352,Brightonsarah.jones@email.com,Sarah
...becomes...
array('john.smith@email.com','John Smith','07798564352','Brightonsarah.jones@email.com','Sarah')
for here you can do whatever you need with the data.
Others may have a better approach but this will work.
Chris J
|
|
|
|
|
I have written a python module to convert CGM (Computer Graphics Metafile) to PDF files. It's limited to one page, A3 sizes only. Does anyone have a need for this program? I can post the code here if anyone is interested. python code here with a brief explanation
I don't know how to do multiple pages, so please tell me how to do this or better yet, download the source and do it yourself.
The CGM format is old, clumsy to deal with, etc. I wrote this to get our decades old image data up to a usable format.
|
|
|
|