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


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Use Strcmp To Edit A Dynamically Generated Dropdown...


I've written a code that runs a 'SHOW DATABASES' query on my mysql server and lists the results(the names of the databases on my server) in a dynamically generated dropdown box, and it works just fine, using the following code:

echo "<select name='databaseselect'>";
$dblist = mysql_query('SHOW DATABASES');
while ($row = mysql_fetch_row($dblist)) {
echo "<option value='$row2[0]'>$row2[0]</option>";
}
echo "</select>";

The problem is that it lists ALL of the databases on my server - that's two of my own user-created databases, and the two default databases that come with the mysql server - 'information_schema' and 'mysql'.  What I want to do is to, after running the 'SHOW DATABASES' query, eliminate those two databases from appearing in the dropdown box, because I don't want anyone to see them, as they're useless to anybody else. Code:




View Complete Forum Thread with Replies

Related Forum Messages:
Dynamically Generated HTML
I am trying to fit dynamically generated HTML into a variable so I can mail it out to a recepient. Now - the catch is that the dynamic generated HTML contains nexted regions which mace some heavy duty use of "if" and "while" statements. Here is a code snippet example:

$msgbody = "<a id="top"></a>
<table width="100%" align="center">
<tr><td><span class="style3">$mailinga[analysis]</span></td></tr></table>
<br />"
----> this is where the error occurs - it says unexpected T_IF <----
if I set a semicolon after the quotes above it will not include the stuff below, and I tried other combinations of symbols and googled the issue but no go - please help.
---->:(
if($asnc > 0)
................

View Replies !
Dynamically Generated Calendar
in a book that i've been reading/ read, there is a project example in which a calendar and its tables are drawn by php, using mktime and getdate, and checkdate, etc. it is only a display calendar, using html select element (also created dynamically) for the user to enter a month in a year in which he or she wants to see that month of the calendar. i'd like to take it one step further by making the cells clickable so that data can be entered, and the event data would be stored in MySQL.

View Replies !
Dynamically Generated Results Table
I'm trying to write a script that dynamically generates HTML tables depending on the results from an SQL query. So far, I have managed to set the HTML table headers to be the same as those in the MySQL table. [thanks to rod k -cheers !]

Now i'm trying to put the results in the table. Basically, I need a MySQL function to retrieve data and put it into the table until there is no data left....

(At the moment I am using "mysql_fetch_array()", but with this it is necessary to know the names of the columns to retrieve the information for each result set. Since my table is dynamic and should be able to build itself from different MySQL tables, the column names aren't fixed and so i can't use this to put the data in the tables...)

View Replies !
Getting Dynamically Generated POST Data
I'm trying to get POST data that was dynamically generated and I'm not sure how to go about doing this.

View Replies !
Populating Dynamically Generated TextFields
If one assigns something to the value iattribute off an input /text field, that value will be displayed when the form is loaded. My problem is, when building a form dynamically, the only way I can get the text to show is by doing the above, however, as this is an update form, when the form POSTS to processUpdate.php,
both the data entered by the user AND the data in the value attribute are inserted/updated.

So, how does one dynamically build a form where the data is displayed in the text fields but value atttribute is not set. PHP Code:

View Replies !
Highlight Dynamically Generated Text
I have a search form which makes queries to a database. In the form the user can search for many words (word1 && word2 && word3). I want in the results to highlight the words that the user has searched for. I 've searched in the internet and i've found some codes but none of them works with all the possible results.

What I have found so far which is closer to what I want is the following:

View Replies !
Uploading A Dynamically-generated Image
I have a script that generates an image based on users' inputs. How would I make it so that the script automatically uploads that image to a different folder on the server? I'm stumped on this one. Does anybody have any ideas?

View Replies !
Refreshing Page Dynamically Generated
We have a problem with a PHP page on our site, the page is dynamically generated from a database, when we refresh this page after we have updated the database it will cycle though and refresh itself about 8 or 9 times before displaying the page, at first i thought it was the browser, but it does it on a couple of other machines too.

View Replies !
Dynamically Generated Drop Down List
I have two tables - one named HOBBIE_TYPES, the other named MY_HOBBIES. The HOBBIE_TYPES table contains records listing a wide variety of different hobbies. This table is used with a PHP script to dynamically generate a drop down menu on a form that users can use to select and specify their favorite hobbies. Once they do so, their selection is added to the MY_HOBBIES table.

However, if a user decides to add more hobbies to their profile, I want the drop down list to exclude any hobbies that they have already added in the MY_HOBBIES table.

The code that I am using is as follows, and it is not doing what I want:

PHP Code: .....

View Replies !
Dynamically Generated Form And Update Problems
In brief, in the following 2 portions of code I build a form based on data retrieved from a database. The second bit of code receives the posted data for processing and updating the database. Problem is that the update occurs for the first row of data but none of
the rest. I'm using a hidden field, written in dynamically (
name="tfHiddenId<?php echo $j ?>" ) where $j is a counter var in a loop.

When I print out the POST_VARS everything is as I want to be, fields all
named according ly, as above. Just the update either 1) only does one
row and quits or 2) updates same row with the same data over and over ( I
suspect the latter ). Apparently my counter variable is not being incremented, but only on one var, "tfHiddenId".$i , on the receiving page. Here's the code for where the form is built from the DB: PHP Code:

View Replies !
Dynamically Edit SQL
I would like to have my results of an SQL query populate a tabel, which i have already set up and is functioning well. However now i would like to have another page, where the informatino is editable. What do you guys think the best way to set up a table that a user can edit the information in a SQL database without entering PHPmyAdmin?

View Replies !
Multiple Submit Buttons In Dynamically Generated Form
I have one big form on a page, within which is a list of text fields pulled from a mysql db. Each text field has an 'update' button, which submits the main form, and should UPDATE the textfield it relates to.

The problem is, all the buttons have value="Update" and I can't think of an efficient way of passing the unique id of each record to be submitted with it. Obviously, having a hidden field for each textfield won't work because the form will use the last one displayed.

View Replies !
Dynamically Selecting Default From Dropdown
I have a dropdown menu with 17 options that I want to use to edit a mysql entry. Before I edit it though I want to load the value of that particular mysql column as the pre-selected value in the drop down. Whats the best way to accomplish this. I figured I could write 17 if than statements but thats seems a bit tidious especially if I have more then 17 options. I'd preffer to have the code written out for the options and just add in the selected statement if possible. PHP Code:

<select name="country" id="country">
                <option value="1">CAN</option>
                <option value="2">USA</option>
                <option value="3">RUS</option>
                <option value="4">CZE</option>
</select>

If the result for country = 1 I'd like to add the selected code to the option.

View Replies !
Dropdown List Which Selects A Post A Title (to Edit)
I want to have a dropdown list which selects a post a title (to edit), then when you click submit I want to use POST to submit the data for that post (post title, username, subject, content) so that the edit pages form fields will already be filled with the posts data.

View Replies !
[PEAR:QuickForm] Dynamically Change A Dropdown Menu According To Another Menu?
I've been using QuickForm for a few months now and I am now given a
new challenge:

I've got a search form with a dozen of dropdown menus, the first
dropdown menu being "Brand". If you select either Brand A, B, C, D...
Z, the second dropdown menu "Model" must be dynamically changed to
model AA, AB, AC, AD..., according to the models manufactured by the
brand selected in the first box.

I've seen that done on quite a few sites, but never found if QuickForm
had a quick & clean way of doing that.

View Replies !
Strcmp
For comparisons between strings, what's faster, the strcmp() function or the manual way (if ($x === $y) .. ). I've heard mostly that strcmp() is faster, just wanted confirmation from the experts here;).

View Replies !
Strcmp Problem
I done a program to read text file, where content is

#Header#
name: Juicy
age: 25
@Header@
#Text#
user text here
@Text@
#End#
tel
fax
@End@
eof

And I read the text file

$filename = "/usr/local/file/rpt.txt";
$fp = fopen($filename, 'r');

$content = fgets($fp);
while(strcmp($content,"@End@")<>0) {

$content = fgets($fp);

if(strcmp($content, "#Text#")==0){ //not match
$strPretext .= $content;
}//end if
//end while


I should get the data from #Text# until one line before @End@, but I get
nothing, I found that the strcmp for #Text# always not match when it read
through whole file.

View Replies !
Strcmp Vs Equal
I noticed in some examples to the encrypt functions of the PHP manual a
syntax was used for password checks such as

if (strcmp($userpassword, md5($_POST['password'])) == 0) {
// do login
}

What is the advantage of this compared to

if ($userpassword == md5($_POST['password'])) {
// do login
}

?

View Replies !
Difference Between Strcmp() And ===
I have two strings, and I want to compare them to see if they are absolutely
identical or not. Previously I would have done this using strcmp() and
checking to see if I got the integer 0 back. However I am noting that it
looks I can use the === comparison operator, and I should be able to get the
same thing?

Is this the case? Is there any reason to use strcmp() when the only thing I
want to know if whether or not two strings are identical?

View Replies !
Strcmp Checking
I have a script that checks answers to a quiz in this fashion: Code:

if (strcmp($ques1, 'ques1answer')) {
$wrong=$wrong+1;
}
else{
$right=$right+1;
}


However, I have one question that has two text fields, and both of them need to be correct in order to get the point. I tried this, but it didn't work:


Code:
if (strcmp($ques1a, 'answer1') & strcmp($ques1b, 'answer2')) {
$wrong=$wrong+1;
}
else{
$right=$right+1;
}

Does anybody have an idea of what I could try?

View Replies !
Dynamic Dropdown And Hardcode Dropdown In Select Form
I have plenty of examples of dynamic dropdown choices but none of hardcoded dropdown choices. The ultimate goal is to have a job with various tasks and to track the status of those tasks for a given job. I've used one of the tutorials here to begin the process. Below is the code I have to add work on a given task. Perhaps I actually need to "Update" a job as opposed to "add".

But the problem of the moment is I can't seem to hardcode one set of my options. This is the code I have: PHP Code:

View Replies !
String Equality: == Or Strcmp?
If I am trying to check if two strings are equal, would I ever run into problems by using == instead of strcmp?

Similarly, if I don't actually need to see which string is "greater" than the other, would == suffice?

View Replies !
String Compare Strcmp
I have a quick question about php strcmp The manual states the following Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. PHP Code:

IF ( !strcmp ($str1, $str2 ) ){
    # DO WHAT EVER AND WHEN EVER both strings are exactly equal and strcmp = 0 or FALSE
}ELSE{
    # DO WHAT EVER AND WHEN EVER strcmp is LESS than zero or GREATER then zero or TRUE as it were
}

View Replies !
Dynamically Populate Drop-down List And Dynamically Include Html File
We have a drop down list on a PHP page, with several product names, and
when people click one item, we will refresh the same page with the
product name as parameter, and in turn we want to include a HTML file
into the content area of the same page.

I know it is recommended to put everything into database, but we want
the web site to be very "portable", so the drop-downlist and the
content should both in text files.

Let's say the drop-down list will be poplulated from the product.txt
file, and there will be a file for each corresponding item in the
drop-down list. From the user point of view, if he wants to add a new
product, he will just need to open the product.txt file, and add a new
line with the product name, "Laptop", then add a new text file named
"laptop" in the same folder which contains the HTML fragment to be
included in the content area.

What is the easiest way to do this?

View Replies !
Case Sensitive Comparisons With Strcmp?
I've written a mod for phpBB to give the forum admin more control over
the smilies. Part of the mod checks to make sure that no two smilies
have the same code.

code = :), :-), :D, :P, :lol:, :happy:, etc.

For some reason my mySQL code is finding a match between :D and :d, :P
and :p, :cool: and :COOL:, etc. Other than that it works fine.

$sql = "SELECT smilies_id FROM " . SMILIES_TABLE . " WHERE
smilies_id!='" . $smilies_id . "' AND code=STRCMP(code, '" .
addslashes($code) . "')";

I've just noticed that I can get around this (sort of) by comparing the
filenames as well, ie. :D and :d would be linked to the same smiley.
But I'd still like to know why STRCMP (which is case sensitive) is
finding a match between D and d.

View Replies !
Question On Using "strcmp" To Compare Unicode Strings
I am confused by the rule of comparing two unicode string using
function "strcmp". For exmaple, using "strcmp" to compare two Chinese uincode string, depending on what rule can "PHP" decide one string is greater or less
than the other string?

View Replies !
Php Script Generated By Php
I am trying generate a new PHP file from an existing page using PHP. Currently I'm using the output buffer to capture content destined for the page, and then am capturing that output and writing to a file.

The problem I am having is that all PHP scripts within the new page content are executed and the results are written to the new file, when I would like the PHP code itself to be written to the new file, unprocessed.

So now I am trying to just store the new page as a string and bypass the use of the output buffer, but do not know how to store php code within a string without having it execute...

View Replies !
Generated Textbox
I've got a web forum that has three buttons: next, forward, start. They serve as simple navigation through records of a mySQL database. I've also created a text box with php to display which record they are looking at: PHP Code:

<?
function textbox($the_name,$the_value)
{    
$_output = "<input type='text' name='".$the_name."' value='".$the_value."' maxlength=&#393;' size=&#394;'>
";
        return $_output;
}
//Generate dynamic textbox
        echo textbox('alpha',$number]);
?>

This works great for display the record but I thought, what if I could have the user enter in a record also to this text box. I've got html forms that do just that using POST method, but it would be nice if they could do it right at that textbox. Any ideas?

View Replies !
Php.exe Has Generated Errors
I think this may be a Win 2K problem, rather than a PHP problem,
but I've suddenly started getting error messages when I run PHP
from the command line. For example, when I run "pear help" or
"pear list", the windoze error message, "php.exe has generated
errors and must be shut down. You will have to restart the
program" comes up when the interpreter has finished. Code:

View Replies !
PHP Generated RSS Feed
I wrote a script in PHP that queries my news database and builds an RSS feed from it. Unfortunately, the RSS feed is invalid, according to Mozilla Thunderbird. My RSS feed is as follows: Code:

View Replies !
Generated Graphics
I am planning to use PHP to generate graphics Actually boxes that will contain either text or links I will use

ImageCreate(), imageColorAllocate(), imageRectangle(), imageLine(), imageArc(), imageJPG()

And I just realized that I have no clue on how inserting a text and positioning it?
Where should I look to figure it out? CSS I am not in love with image positioning too many unacounted for variables such as browser etc.

View Replies !
Php Generated Mail
I have created an online form in html. i am using php to send the information as a mail to the desired email adress. The thing is that if anyone fills in an incorrect email adress, then it bounces back to my webhosting server. Those guys are now complaining that their server is being spammed. when it indeed is mails bouncing back from incorrect adresses. How can i make the mail bounce back to myself or just avoid any bouncing what so ever? The code im using for the mail function is:

mail("$sender", "Thank you for registering!", $reply,"From: $onlinemail
-Reply-To: $sender, $onlinemail");

View Replies !
Generated E_NOTICE
Could someone please let me in on the workaround for this: PHP Code:

if(!defined(SD_CURRENT_TEMPLATE))
    define('SD_CURRENT_TEMPLATE', 'sd-default');

It generates: Quote:

Notice: Use of undefined constant SD_CURRENT_TEMPLATE - assumed 'SD_CURRENT_TEMPLATE'.

View Replies !
Caching JS Generated
Im developing a service where my registered users must include a javascript on their websites.

Since each user has different config settings on my service, they must all identify themselves with an ID, for example, user John Doe must include this piece of code in his site:

<script src="http://blabla.com/script.php?id=384" type="text/javascript"></script>

That way the javascript that will get printed will use his own settings. What i need to do now, is to reduce my server's requests by properly caching the data. A friend told me to use this in the top of script.php: Code:

View Replies !
Php Generated Checkbox
I have some checkboxes and drop downs generated by php, the problem I am having is that on the check boxes which look like this: PHP Code:

echo "<p>The price for Service 1is: £$service1priceprice, type of rate: $haircolourtype Tick the box if you want to enquire on this service:<input type="checkbox" name="haircolourselected" value="true"</p>";

When the page gets submitted however, the checkbox returns blank and of course as a result of this code setting up the post variables will enter a null value into the database instead of tru: PHP Code:

if (!isset($_POST['service1selected'])) {    
    $service1selected = 'null'    
}else{  
    $service1selected = $_POST['service1selected'];  
   
      }.

View Replies !
Checkboxes Dynamicly Generated
I have a form with 3 checkboxes wich have all the same name:

<input type=checkbox name=test value=val1>
<input type=checkbox name=test value=val2>
<input type=checkbox name=test value=val3>

now on the target page i need all values that are checked, so if they are all 3 ckecked i need to get val1, val2 and val3 on the target page. With ASP you get the varaible test = val1;val2;val3 (the values are all put in one variable, separated with a ";"

But when i use PhP i only get the last value in this case "val3". What do i need to do to get all values? I have named them all the same because those checkboxes are dynamicly generated. I dont know how many there will be.

View Replies !
Using Php Generated Pictures With HTML?
I am able to create images with the use of the GDLIB.
but I am not able to use these images together with HTML. I always get the
message "headers are already sent.

View Replies !
I Am Trying To Pipe In Some Auto-generated PHP Into Php.exe
I am trying to pipe in some auto-generated PHP into php.exe, to no
avail:

View Replies !
How To Farmat Php-generated Table
the font size declaration seems to be ignored. Is it possible to set format for
tables generated with php?

<?php

echo "<table border=1 font size=8>";
echo '<tr><th font size=8>Date</th>
<th>IP Address</th>
<th>Operating System</th>
<th>Browser</th>
<th>Referring Page</th>
<tr>'

?>

View Replies !
Getting MySQL Generated Keys
I am a Java/JSP developer by trade but am currently developing a
MySQL/PHP solution.

In JSP when I run an INSERT statement on the db I am able to
automatically get back a list of any generated keys (without having to
do some sort of subsequent query to get the information).

Is there a PHP equivilent of this?

View Replies !
Php-generated Png Transparency Issue In IE
I've been trying to get my page, which works perfectly in Firefox, to work in IE as well. one problem was getting the .png images to display properly, which was fixed by doing this:

filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='imagename.png')

but what of php-generated .png files? putting the php file as the src doesn't work. the php-generated images don't work at all in IE (but work fine in firefox).

(the php-generated image uses a transparent color made with imagecolorallocatealpha. when I just use imagecolorallocate it shows up, but is not transparent as I want it.)

View Replies !
Generated PHP Web Database Forms
I'm still gaining experiance in developing PHP applications, and have completed
a couple of projects already.

This has prompted me to look for ways to reduce the development time for web
enabled database applications. Every web database has basic operations such as
add,delete,update and search. I have been creating HTML forms and processing
the results with php code. I have managed to reduce the number of forms required
by using the smarty template engine.

I want to go a stage further and be able to produce the forms and the processing
code purely by looking at some sort of schema file , or using
"mysql_list_fields()" and "mysql_list_dbs()".

Before I start my quest of many late nights of coding. Can any of you guys
give me a head start by pointing me at a solution/hint.



View Replies !
Generated Images Not Printing?
I have a problem with IE and generated images (jpgraph). It displays
them fine but it's not printing them. They appear as little red crosses
in print preview.

I've fiddled with the cache control headers as I thought that was it.
Certainly IE refuses to cache pdf files sent using fpassthru and cannot
open them in acrobat.

View Replies !
Server Generated PDF Files?
Heres what I need to happen now, I know how to do most of it, except the generated PDF form.

- The server puts that information into a PDF file with a background of my chosing and emails it to a specified adress. (Its already set up to send the email)

My issue is I dont know how to have the server generate the PHP form. How does it work? How do I position the text over the PDF automatically?

I'm already donating $10 to the site, thanks to the help I received from UTAlan, Lytheum, and Waldir. Ill make it a total of $20 after this.

View Replies !
Image Src Generated Through Php File
I've built a custom image gallery, integrated with a database. all of the images are kept above the document root in a "media" directory (for security purposes); therefore, i am using a php script in the src attribute of the image tags to display the image in the browser.

to accomplish this, i chose to use the PEAR package "HTTP_Download", which worked great and performed fantastically on my staging server.  I chose to use content-disposition inline, and set caching options on.

the problem, the images don't cache on a users machine.  therefore, everytime the page is changed to display a new image, all of the thumbnails are downloaded once again...very annoying. let me re-iterate, these files are not being generated on the fly, simply sent to the user via php. Code:

View Replies !
Mail A Php Generated Page
I ask if it's possible to sent to email a php generated page as an html attachment or text file !?

I have searched on google, but I find only how to send mail from php not hot to send a page.

Any link, or doc is helpfull !

The story:
I have a long products list, from where I select some items what I want to send as a price list to some people.

View Replies !
PHP-generated RSS Feeds And .xml Files
I want to make an RSS feed for my site.  Obviously, it should be dynamic, so the only way that comes to mind is to use PHP to create the RSS.  But then the filename will be .php.  Most of the sites I see with feeds (digg, shoutwire, cnn, etc) have .xml files.  How do they do this? I would like to have a .xml that is dynamic/always up-to-date.

View Replies !
Randomly Not Generated Whole Page
I bump into a weird problem. Randomly a page is not fully generated. When I reload a page most of the time it's OK but sometimes (without any apparent logic) only a part is generated and sometimes some PHP errors appear (about missing functions, unfisnished regexp etc.) as though some scripts were not properly parsed or loaded.

The application itself ran without any problems on other two servers. The server where the problem occurs is FreeBSD, PHP4 with AfterBurner accelerator. Unfortunately, I don't have access to the server, so I cannot check further settings and logs. Does anybody have an idea what can be going on?

View Replies !
Ampersands In Generated URIs
The way I read the following apache page . i should be able to put this line
php_value arg_separator.output &amp;
in an .htaccess file, so that all the ampersands in URIs generated by php are converted
to &amp;

It's not working for me ye. what I've done wrong?

View Replies !
Emails Generated By Php Mail
I'm having a serious problem with the emails generated by php mail script on my sites.
All works perfectly well (or has done up to npow) There is nothing wrong with the script.
Here is an example of the script: Code:

View Replies !
Storing A Thumbnail Generated By Gd On DB?
I'm still working with this gallery thing if you read my posts a few days ago! Look, I've got some thumbnails generated with gd from pictures sent over a form. To store these files on the database I would use something like: Code:

View Replies !
What Does Adobe Think Of PHP-generated PDFs?
I've been making PDFs with PHP. Many of us do. Does anyone know what Adobe thinks of that? Have they ever released any comments regarding unlicenced use of their proprietary format?

A few years back, Compuserve made a real stink about its patent on GIF compression. GIF images were so ubiquitous, many assumed it was just a non-patented generic graphics format. At the time, geek media pundits were saying we'd all have to start using PNGs, or start paying licence fees to Compuserve.

Is this a similar situation, and are we going to get busted for reverse-engineering Adobe's Portable Document Format?

View Replies !

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