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




2 Questions. Dropdown Menu And # Of Rows.


1. I have a table named pics and a column named name, just to let you know for use. I want to take the data from each row in the name column and insert it into a dropdown menu.

I know how I could do it, but I would have to go:

Code:
<SELECT NAME="name" SIZE="1">
<OPTION SELECTED><?php $name[10 ?>
<OPTION><?php $name[1] ?>
<OPTION><?php $name[2] ?>
<OPTION><?php $name[3] ?>
<OPTION><?php $name[4] ?>
<OPTION><?php $name[5] ?>
<OPTION><?php $name[6] ?>
</SELECT>
but then I could make too many or too less. I want it to automatically adjust to the number of rows.

2.What is the code needed to find out how many rows are in a table?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
[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.

Dropdown Menu
I want to upload a feild values into a dropdownmenu. can anyone help me how to write in php code.

Advanced Dropdown Menu
I want to populate a dropdown menu with countries that are in one column of my table. I know how to do that, but I can't find how to eliminate multiple items. Some countries appear several times in different rows, but I only want each available country to be shown once in my dropdown list.

Mysql / Dropdown Menu
what i am trying to do is to make a system with a few input pages and edit and read pages..

so right now i got the input/edit/read pages working. (yay) But now I want to have on 1 input page a dropdown menu that reads its information from the database. and that if i go to the page i can select a value out of the db and submit that inside my form and that it reminds the value if i view or edit the page.

So what i got now is a little system that is able to add/remove/edit a value inside a field called "drop01"

Well now i got a other input page called "input01.php" inside this script i want to have the dropdown menu that reads its values from the "drop01" field. PHP Code:

Autoselecting A Value In A Dropdown Menu
I'm revamping my sites administration panel and I put in a dropdown menu to select the section to administrate (it was a LOT better than the list of links I had before, I'll probably update it some more though) and I want to know how I can autoselect whatever page I'm on in the dropdown menu, for example, here's the menu: Code:

Multiple Dropdown Menu
i attemp to design a drop down menu that call up data from a table for each drop down menu. Code:

Dropdown Menu Without Submit Button
How do I get a dropdown menu to submit with the selection of an option rather than pushing the submit button.?

Searching Database With Two Dropdown Menu
I have searched the whole forum for the script. Please let me know if there is any script .

Unwanted URLs In URL Dropdown Menu
I'm working on a PHP script and it has a user login, and the variables (username, password, id number) are passed via the URL bar. Is it possible to somehow not allow the visited page show up in the dropdown list of URLs in the browser? The problem is that people can view the list and easily see people's usernames and passwords. Example:

http://www.somesite.com?username=john&password=12345 What I only want is:
http://www.somesite.com/

I know that Hotmail.com doesn't show all of the pages that have been visited, all it shows in the list is hotmail.com, so I think it is possible to do this, but I don't know how.

Make A Dropdown-menu Filter?
I have a dropdown menu which is supposed to filter a table to show results for professionals, students or all. But I don't really know what I'm doing.  This is what I have so far. Code:

Initially, I was able to filter for students or professionals, but since trying to have an all option (students and professionals) it has gone to pot, and I keep getting errors.  I know that my quotation marks are not right, but I can't think of a solution. I would be more than happy to see any ideas, even if they are completely different to mine!

Query From Db, Add Values In Dropdown Menu
i wanted to query my db, and then add values to drop down menu, where when they select what they want in the dropdown, it will bring them to another page accounts.php where they will have more options.

Dropdown Menu <selected Name="...
I have a dropdown menu like this one:

<select name="country" tabindex="6" id="select_country">
<option value="">- Country List -</option>
<?php 
$query = "SELECT * FROM country ORDER BY country ASC";
$result = mysql_query($query) or die('Error, query failed');
while ($row = mysql_fetch_array ($result)) {
$country = $row['country']; ?>
<option value="<?php echo $country ?>"><?php echo $country ?></option>

After I have selected one country and I hit the submit button it go back to the default value in the box, what I want is to show the selected value in box until I selected another value.

If the default value is Australia when I start this page, I then select USA and hit the submit button it reset to the default value "Australia", but I want it to show USA as long I not select anything else. I have tried to use session in selected="<?php echo $_SESSION['country']; ?>" but it didnt work.

Change List View To Dropdown Menu
Im working on a script that has to be change so a user can choose from a dropdown menu instead of a list that now is displayed.
Here is the part that is insert on the index page.

How To Pass The Value Of Selected Dropdown Menu To Another File?
there is a php-myql script that list the mysql databases in the drop-down menu, use wil select one and the submit button should pass the value or variable $db_name to the test.php, this script list the databases in the drop-down menu but when i select one and then click on submit cannot pass the db_name to the test.php:

Populating "Month" Dropdown Menu
I can get the current month to display in a text box by inserting
value="<? print strftime("%B"); ?>"> into the code for that
particular text box on a form but how can I populate a drop down with
names of all the months with the current one being 'default' as it
would be in the text box example?

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:

Count Amount Of Rows In Same Query Of Selecting Rows
I am selecting some rows from a table and i wonder if i can count
the amount of rows in that same table in the same query? I tried something like: PHP Code:

Several CMS Questions
I am fairly new with PHP but I have used several news posting scripts in the past and none have been simple enough for me. I'm working on creating a site with the following layout, and I need help on a few issues along the way (those questions will be in bold so please check them out, even if you don't want to read everything else!).

The basic site layout will use a few "template pages." I.E. main.php and print.php and textonly.php. What they are is fairly self explanatory. The further pages will be accessed in the following manner: http://mysite.net/main.php?content=FAQ Would import a file called faq.php/html/txt (which is the best form for my content?).

I also want a news page. Should it be imported in the same way as the other pages (I.E. main.php?content=news)?
On every page, I want a "headlines" section with the last 5 recent "headlines" (from the news) and a link to them. On the news page, I want the last 5 news items listed. For my news system I could use MySql or just Flat files (I.E. a file called news.txt which has a uniqueID|author|title|date the uniqueID is the name of a .txt file with the content of that news item). All news items (not just the most recent 5) are found on an archives page, listed by headlines/date/author. Which is better (MySql or Flat files, considering how simple this news system will be Flat may be simpler) and how can I set it up in the way I asked?

Also, I created a simple system of PHP to go to different pages depending on the ?content= variable. I want it to go to a specific page if ?content= anything not listed in my variables. Here is what I have, it works except it won't go to google.com if anything "else" is written. How can I fix the code below to work?": PHP Code:

Else If - Questions
I have put togther a script which uploads images and renames them with the article ID, so that image names are always related to the article that is added.

But....when calling the individual article to view in a html page I want it so that if there is an image it shows it other wise don't show anything or show a blank pixel image. This is what I have tried and it does show if an image is there, but if the is now image present it shows an image box with missing link. Code:

A Few Questions
Say I wanted to send an HTTP request to a web server on port 80 - would
fsockopen or socket_create be better to use?

Also, I'm unsure of whether or not stream_set_blocking would be a
useful function to use for HTTP queries... any ideas?

Finally, the output of this seems a bit surprising:

<?
ob_start('test');

function test()
{
return getcwd();
}
?>

It displays / while the following displays something like
/path/to/file/

<?
echo getcwd();
?>

Pdf Questions
I have a pdf govt issue tax form for non-profits and am trying to
write a script that will handle browser based entry of data fields as
well as save some info to database

It is a tax form and has to be parsed to the pdf file that the govt
provides for printing...

Am completely stymied on how to pull all the field data, and to post
it to the pdf the pdf in question is



Questions About PHP-GTK 1.0
PHP-GTK is the ticket one can take to create cross-platform
PHP scripts that load a standalone GUI application with widgets, and
then everything else you know about PHP can work in the background via
signals (widget events), including database access, etc.

Some background for you:
http://www.sitepoint.com/article/697

Personally, I can't get it working. Others have, strangely enough.

1. I have RH9. Does anyone have an RH9 RPM out there for PHP-GTK 1?

2. Would it be good for me to install Glade to draw the GUIs and
connect the signal handlers faster? I don't have experience with
Glade.

3. I tried downloading the 1.0 source and then doing:

../buildconf
../configure
make
make install

but it bombs on ./configure with...

../configure: line 2606: syntax error near unexpected token `debug,'
../configure: line 2606: `PHP_GTK_ARG_ENABLE(debug, whether to include
debugging
symbols,'

4. I tried the steps recommended in the sitepoint.com web link I
posted (above) and it showed the same error, so I commented out the
code block starting with if on line 2606 to its following fi. Then, I
ran the commands as recommended from the web link, it runs good for
awhile and then spits back to me this error:

/home/me/installs/php-gtk/build/dynlib.mk:22:
/home/me/installs/php-gtk//libs.mk: No such file or directory
make: *** No rule to make target `/home/me/installs/php-gtk//libs.mk'.
Stop.

What's the catch?

Looking For Dropdown Help
I have a dropdown in which i want it to open a soundfile when selected. So, how do I go about this. The form will get submitted, and through a series of conditional statements it will point the right selection to the right if statement. but what do I put in the if statement to get it to open a realplayer with my ram file?? Here's what I got so far.
Code: <FORM ACTION="<?=$_SERVER['PHP_SELF']?mode=changedropdown?>" METHOD="POST" NAME="sermondropdown">
<P>
<SELECT NAME="sermons" SIZE="1" onchange="this.form.submit();">
<OPTION VALUE="pleaseselectasermon">Please Select a Sermon
<OPTION VALUE="082403Daniel_1_1-8">August 24, 2003 Daniel 1:1-8
<OPTION VALUE="083103Daniel_1_1-8">August 31, 2003 Daniel 1:1-8
</SELECT></P>
</FORM>

<?
if('changedropdown' == $_GET['mode']) {
$selection = $_POST['sermons'];
if (?Daniel_1_1-8' == $selection) {

} elseif (?Daniel_1_1-8' == $selection) {

}
?>

Dropdown
I have a dynamic drop down that needs to be populated from different columns in a database. The problem I'm running into is that sometimes fields do not have a value. So I would rather those didn't print out. The code below prints out the blank fields.

I know I need to loop through and check for an empty value, but I'm drawing a blank on the how part. Code:

Dropdown Possible With PHP ?
i'm looking for a way to do the following :

1. selecting data from a MySQL database
2. putting one field into a dropdown
3. after selecting a value from the dropdown follow some more php code

step 1 is no problem, step 2 is no problem with the html select statement however this leaves me on the client side. After this i'm not able to return to the server side to execute some more php code, with the onchange attribute i can start some javascript but i want ( read need ) to use php code. Concrete question : is there a way to create a dropdown in pure php code ?

Dropdown Box
I currently have a dropdown box on a page. What I would like is that when a user selects something from the dropdown box it automatically changes the display of another box.

Value In A Dropdown
I have a piece of code where I get the player_id value from the url at the top of the page. Rather than this I want to get the value from variable named $player_one. Code:

PEAR Questions
Can someone explain to me exactly what PEAR is?

I've been looking around for different html modules/classes and it keeps coming up, but I can't find anything that actually explains what it's all about.

Also, is there a complete list of "PEAR" modules anywhere, organised in one place?

Cron Questions
Just a few questions about cron files:

Can I include other files? Eg

<?php
require(config.php);
....

That's pretty much it! I'm running a cron job from DirectAdmin and I keep getting an error email with:

/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 1:?php: No such file or directory
/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 2: //: is a directory
/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 3: //: is a directory
/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 4: //: is a directory
/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 38: //: is a directory
/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 39: syntax error near unexpected token `('
/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 39: `$udq = mysql_query("SELECT * FROM $CustomersTable",$Link) or die(mysql_error());'

And if I run the file in my web browser, it works fine! Confused :S

Login Questions
I have 2 books 1.) MySQL/PHP Database Applications and 2.) PHP4 Bible. My problem is that in both books the only way they show how to use a login form is to use the HTTP_AUTH. Which I don't want to use, I want my script to do the login and log out Like VB does. Where or how would I go about doing this? I can enter data into MySQL, but I know i am missing some steps, such as Md5ing the Password and sessions and such. Any info would be great.

IMAP Questions
I've spent hours, days .... weeks(!) reading the manual, but still can't find answers to my questions regarding the use of some IMAP functions and their miscellaneous properties.

From now, I'm gonna list all those questions on this thread and see if some of you can provide even partial but useful comments.

Question number ONE : imap_setflag_full

In imap_setflag_full($mbox, "2,5", "Seen Flagged"); we have the string sequence "2,5" but I fail to understand if it is safe or not to choose any sequence I want regardless of the message structure.

For example, if I apply a "Flagged" flag on all incoming messages exclusively at "2,5", is it possible that I could overwrite some precious information in that particular place? What are the implications of such a method?

Questions About Config.php
We all know its effective to create one central config file say "config.php"
that contains the required configuration variables.

I had seen the configuration is done by three ways:

1> By simply using variables ex $dbHost = ""; etc
2> By using associative arrays ex $setting['dbHost'] = ""; etc
3> By defining constants ex define("DB_HOST",""); etc

My Question?
Which one to use and why in config.php for creating the configuration file?

A Questions About Mysql_fetch_array()
whenever i use this, i'm leaving out one item from the array. in other
words, one row from the table i'm querying won't show up. i'm new at
php, and this is probably a simple thing, but please help of you can.
here's an example that leaves out the most recent submission:

$query = "SELECT topic, message, author, DATE_FORMAT(posted, '%M %e,
%Y') AS d FROM messageboard ORDER BY posted DESC";

$result = @mysql_query ($query);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC) ) {
echo"<p> {$row['topic']}<br>
{$row['message']}
<br>Posted by {$row['author']} on {$row['d']}
<br>";
}

Pcntl_fork Questions
php.net's docs on pcntl_fork aren't exactly clear on how to spawn
multiple child processes...

i tried something like this, but it didn't seem to work:

<?
$pid1 = pcntl_fork();
$pid2 = pcntl_fork();
$pid3 = pcntl_fork();
if ($pid1)
print "test;
if ($pid2)
print "test2";
if ($pid3)
print "test3";
?>

any ideas why it didn't work?

PHP GTK Option Questions
Before I invest more time in researching and testing I am curious if anyone knows for certain if a PHP_GTK application running on a Windows machine can communicate and interface with a remote database SECURELY?

My plan involves creating a support system which would be a standalone application on a Windows Workstation. This application would query data from a remote database SECURLY and then support personal would be able to modify, edit, etc. data from the PHP_GTK application which would in turn update data in the remote database, again securely.

Can a PHP_GTK application support this, security being the biggest concern?

Questions About Sessions
First, just wanted to say that I found what I thought was a very helpful
tutorial on sessions in case anyone out there has questions on them:

I've been using sessions for quite some time but only after reading this
do I really understand what is going on on both the client and server side.

Unfortunately, I still have some unanswered questions after reading it,
as it is pretty basic and gives a quick intro to sessions. For testing
purposes, I turned off all cookies in IE and attempted to sign into my
site on my local host, which uses sessions for signing in. In addition,
session.use_trans_sid = 0 in my ini file. I can't figure out how, but
somehow my scripts all still work and I am able to login fine, even
though cookies are disabled, as well as trans sid. How is my session id
being passed, as my understanding is these are the 2 possible methods?
There is no sessid propagated through the URL either, so it is not
through a get variable.

Also, I looked in my sessiondata folder and found a bunch of session
data. When I physically log out and kill a session, it removes it from
the folder. However, when I just close the browser window, it does not
remove the data from the folder. Reopening the browser right away
results in a new session and requires the user to login again, but the
old data from the previous session is still there. I checked my ini,
and found the default:

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440

But this isn't working as far as I can tell because I have session files
from days ago, and according to this it should be deleted after 24 minutes.

PHP Interview Questions
I have reasonable PHP experience, but not yet a guru. I am going to an
interview this week for a PHP role, they develop a portal system used by
governments departments to create a common entry point for state
government services.

I have been advised they will be questioning my skill level on PHP, and
although my strengths are in Java (which they may use me for also) I was
just wondering what kinds of questions you all may have come across in
the interview, just so I get a feel for what to expect.

Questions About GD And Images
I have a system where admins can upload photos and images....the original photo as well as the thumbnail...At first sight, I had 2 fields, one for the image and one for the thumbnail...however, I was thinking about having only one field while the image should be proccessed by the "submit" script afterwards in order to create the thumbnail aytomatically in the selected folder (/pictures/thumbs/) while storing the original image in the /pictures/ folder...

In the first system I created (2 fields), both images were uploaded in a selected folder while their extensions(names) were stored in the Database...however...if I use GD library to create the new system the whole thing changes...Images are not uploaded but stored directly in the database as strings and called afterwards as images...for instance, the original photo is stored in the database while the automatically created thumbnail proccessed by GD, (opened as text...croped...etc etc.) and also stored in DB as text...Am I right?

PHP Interview Questions
We have collected Questions and answers for interviews after a long
effort and you study these questions and its answers freely our
website. If you have any query regarding to interview you contacts with
us we have reply your problem as soon as possible. I am very Thank full
to you.

Questions About Curl
I was looking at the various cURL options and have a few questions.

CURLOPT_HTTPPROXYTUNNEL's being set to true is supposed to tunnel
through a given HTTP proxy. Afaik, tunneling is only possible when the
CONNECT method is used. Is that correct?

Also, if it is... one can normally tunnel through as many HTTP proxies
supporting CONNECT as they see fit. Does cURL only let you tunnel
through one?

CURLOPT_PORT's value is described as "an alternative port number to
connect to", however, CURLOPT_URL already allows a URL to be added.
Does this mean that if it can't connect on that port, it'll try to
connect on this port?

Session Questions
I have a question regarding the usage of sessions and cookies. I'm still a
fairly new developer, but have built quite a few login-driven applications
using MySQL for the backend and PHP for the front end.

When I have a login, I generally do the standard algorithm - Check the DB
for a matching UN/PW, set a session variable as true (or jsut set the
username as a session var) and then check on if the session['username'] var
is set. If it's set, they're logged in, if it's not they're not and I
redirect back to login.

My question has come up recently as I've seen many PHP developers using
setcookie() and running their code off of this. I'm using the following
method if there has been a matching un/pw combination found in the DB:

if($totalRows != 0){
$_SESSION['username'] = $row['usernameFromDB'];
}

Then, in my include file to check, I'll say something like:

if(!isset($_SESSION['username'])){
header("Location: login.php");
}

Two Header Questions
Is it possible to generate an export file and still showing different
HTML page?

I have a page and when the user clicks on a link I generate export file
(with header and data after header) and the page remains the same. It
would be nice if I could show another page, like message "data generated!".

And I have another question. I have the following code for sending
export file:

header("Content-Disposition: attachment; filename=export.txt");
header("Content-Type: application/octetstream");
header("Pragma: no-cache");
header("Expires: 0");
echo $Data;

but when the Save as dialog appears I get filename "export.txt.php".
What must I do to get the right filename "export.txt"?

Speed Questions
i was trying to append a % before any occurance of either abc,
abd, or abe, in a string. which would be faster?:

$string = str_replace("abc","%abc",$string);
$string = str_replace("abd","%abd",$string);
$string = str_replace("abe","%abe",$string);

or

$string - preg_replace("/(abc|abd|abe)/","%$1",$string);

php.net says that preg_replace is slower than one str_replace, but for
multiple ones, it seems like it would gain a slight speed advantage.

also, exactly how would the following to code segments compare, speed
wise?

for ($num=0;$num<$length;$num++) {
$array1[] = $num;
$array2[] = $num;
}

for ($num=0;$num<$length;$num++)
$array1[] = $num;
for ($num=0;$num<$length;$num++)
$array2[] = $num;

it seems like the first one should require 3*$length operations,
whereas the first one would require 4*$length operations, although i'm
not 100% sure on that.

Session Questions
I currently manage all my sessions through MySQL tables, but obviously this
means database overhead for every single page. I would like to move to PHP
sessions but I'm not sure they do the job.

I'm sure you can all imagine how you would implement database-based
sessions, i.e. generate and store a unique identifer with the user data, and
pass this ID from page to page. On loading the page, get the user data
associated with that ID.

I would like to do this in PHP. However, I'm having problems with the
following:

1. Uniqueness. If someone with the account 'Dave' logs in on a phone in
Brazil, it should invalidate the session anyone else using that same
account, on any device, anywhere. There should only be one session per
account at any time.

2. Overwriting. On no account must anyone overwrite Dave's session and
become that user. This seems to be a problem in my test attempts for no good
reason (and the other user is on a different machine!)

3. Destruction. I, the manager, want to be able to destroy individual
sessions ("boot") at will, if possible.

Can this be achieved, or should I stick to doing it the MySQL way (or maybe
there's a better way)?

PHP5 Questions
I noticed there's an error in PHP when it receives form data. It seems
to precede various characters with "". I was wondering if that's about
to get fixed in PHP5, or already is fixed in PHP4? (Or is this somehow
not an error?)

Also, I was wondering when/ if PHP will include more object-oriented
functions, like $myString.replace($find, $replaceWith). (I sometimes
wonder if I need to use the first or second or third parameter or what
and it takes some more seconds to check PHP.net.)

Next, are there any plans to remove the "$" in front of variables?

Also: will XPath be supported internally/ by standard libraries (I use
a special library not part of PHP and it could be a little faster)?

Will there be real private members/ functions in PHP5 when using
classes/ objects? (And any plans to drop "$this->", not that it's
really bad?)

Cookie Questions
I'm acquainted with PHP about five days (more precisely,
with the web programming in general). However i have some
other experiences in programming.

The first thing i need to do is a reliable authentication
with sessions and cookies. I've create a scratch web-site
for testing this (http://igor.ath.cx:55554/) and have two
questions related to cookies. I use the latest PHP 4 & 5
with IIS5 (CGI mode) under Windows 2000. Php.ini settings
are setup defaults (when using php-x.x.x-installer.exe).

1. When i do setcookie ($vname, $vvalue, time() + 600, "/");
it's saved well, but the cookie does not expire after ten
minutes as it supposed to be (testing with IE6). What's wrong?

2. When i do setcookie (..); and after that (below in the
end of the same script) send a header("Location: $goto");
the cookie is not saved. I've create a workaround. But...
Is it normal behaviour? I can't find clear information on
this in the PHP Manual.

Snmprealwalk Questions
I am using snmprealwalk() to scan for interface types and descriptions on
some Cisco routers. What I am doing is two calls to walk the routers; one
walk for ifDescr.x and the other for locIfDescr.x so that I get the
interface index and our user defined descriptions.

That returns back two arrays which I then combine into one array with a
couple for and while loops, and that gives me a multidimentional array
containing the interface index, interface type, and the description. Things
have been going well, however, I have noticed that some of the newer routers
are not behaving as expected on some of the walks that I am doing.

When I do the two walks as described above, I get something like this:

Array (
[OLD-CISCO-INTERFACES-MIB::locIfDescr.1] ="Local LAN"
[OLD-CISCO-INTERFACES-MIB::locIfDescr.2] =""
[OLD-CISCO-INTERFACES-MIB::locIfDescr.3] =""
[OLD-CISCO-INTERFACES-MIB::locIfDescr.6] ="Internal Modem WIC"
[OLD-CISCO-INTERFACES-MIB::locIfDescr.7] =""
<snip>
)

Notice how it is missing interface descriptions for interface index 4 and 5.
So I manually ran snmpget and I get the snmp error "No Such Instance
currently exists at this OID". The problem is that snmprealwalk() doesn't
fill the array when I get the "No such instance" message - which really
screws up my program.

Is there a way to make snmprealwalk() fill in values in arrays, even if
there is no valid snmp data?

Date Questions.
I'm trying to select all of the dates from my datebase, but over a different time scale.

> past
> this month
> next month
> coming soon

I need to be able to do somthing along these lines, but i'm not to sure what. SELECT * FROM listings WHERE list_date='next month' Can anyone point me in the right direction.

Questions On Sessions
I'm fairly new to PHP, and have just started creating a very basic PHP login system for my site, and have gotten stuck on the login page.

I want it to check to see if you're already logged in, and if you are, display a message saying you're already logged in. If you aren't logged in already, it will display the login form.

Here's the code:

<?php
session_start();

if($_SESSION['user_level'] == 4){
echo "You are already logged in as ". $_SESSION['username'] ."!";
}
if($_SESSION['user_level'] == 3){
echo "You are already logged in as ". $_SESSION['username'] ."!";
}
if($_SESSION['user_level'] == 2){
echo "You are already logged in as ". $_SESSION['username'] ."!";
}
if($_SESSION['user_level'] == 1){
echo "You are already logged in as ". $_SESSION['username'] ."!";
}
if($_SESSION['user_level'] == 0){
echo "You are already logged in as ". $_SESSION['username'] ."!";
}
else {
include 'loginform.php';
}

?>

This works if you're logged in, but if you aren't then it still shows the "already logged on" message anyway.

My second question is instead of using those 5 seperate terms, could I just use one to check whether or not you're logged in?


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