[PHP-DB] Two sql queries

2002-10-02 Thread Bzdpltd

Hi there,

Wonder if someone could help me, I have not touched PHP in a while now so a little 
rusty.

What i have is a news page now the news story is disaplayed when someone clicks the 
item from the home page, which then loads a news page, but the problem I am having is 
when the news page loads it has the links down the left with the other news stories, 
all with the correct id numbers appended to the link, but the news item on the page is 
loading as the last one, and when you click the links it does not load the correct 
item.

Now I know this is something to do with having two sql queries on the same page, and 
the id number being fetched.

Here is the code for the two sql statements on the same page, if someone could help it 
would be most appreciated.

?
//start query code

$sql= SELECT * FROM news WHERE 'Corporate' = division ;
$sql_result = mysql_query($sql); 

if (mysql_num_rows($sql_result) ==0)
{
echo (  \n);
}
else {
while ($row = mysql_fetch_array($sql_result)){
  $title = $row[title];
  $id = $row[id];

echo (tr \n);
echo (td width=\13%\ class=\body\p /p/td \n);
echo (td width=\87%\pa href=\news.php?id=$id\$title/a/p/td 
\n);
echo (/tr \n);
}}

?

?
//start query code
  
$sql= SELECT * FROM news WHERE ('$id' = id) ;
$sql_result = mysql_query($sql); 

if (mysql_num_rows($sql_result) ==0)
{
echo (  \n);
}
else {
while ($row = mysql_fetch_array($sql_result)){
  $division = $row[division];
  $title = $row[title];
  $date = $row[date];
  $content = $row[content];
  $link = $row[link];

echo (h3$title/h3 \n);
echo (p . date ('F jS Y',strtotime($date)) .  /p \n);
echo (p$content/p \n);
echo (p /p \n);

}}
?

There is html code inbetween these two statements, and the id number is passed from 
the index page with the news item listed.

Hope someone can help me in the right direction.

Thanks

Barry Zimmermn

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Two sql queries

2002-10-02 Thread Bzdpltd

Hi there,

Wonder if someone could help me, I have not touched PHP in a while now so a little 
rusty.

What i have is a news page now the news story is disaplayed when someone clicks the 
item from the home page, which then loads a news page, but the problem I am having is 
when the news page loads it has the links down the left with the other news stories, 
all with the correct id numbers appended to the link, but the news item on the page is 
loading as the last one, and when you click the links it does not load the correct 
item.

Now I know this is something to do with having two sql queries on the same page, and 
the id number being fetched.

Here is the code for the two sql statements on the same page, if someone could help it 
would be most appreciated.

?
//start query code

$sql= SELECT * FROM news WHERE 'Corporate' = division ;
$sql_result = mysql_query($sql); 

if (mysql_num_rows($sql_result) ==0)
{
echo (  \n);
}
else {
while ($row = mysql_fetch_array($sql_result)){
  $title = $row[title];
  $id = $row[id];

echo (tr \n);
echo (td width=\13%\ class=\body\p /p/td \n);
echo (td width=\87%\pa href=\news.php?id=$id\$title/a/p/td 
\n);
echo (/tr \n);
}}

?

?
//start query code
  
$sql= SELECT * FROM news WHERE ('$id' = id) ;
$sql_result = mysql_query($sql); 

if (mysql_num_rows($sql_result) ==0)
{
echo (  \n);
}
else {
while ($row = mysql_fetch_array($sql_result)){
  $division = $row[division];
  $title = $row[title];
  $date = $row[date];
  $content = $row[content];
  $link = $row[link];

echo (h3$title/h3 \n);
echo (p . date ('F jS Y',strtotime($date)) .  /p \n);
echo (p$content/p \n);
echo (p /p \n);

}}
?

There is html code inbetween these two statements, and the id number is passed from 
the index page with the news item listed.

Hope someone can help me in the right direction.

Thanks

Barry Zimmermn

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Updating Many Records

2002-04-18 Thread Bzdpltd

I am not sure if this is possible.

I have a database, and we fetch all the records and then list them.

What we need is the one field in the database to be able to be updated.

Now  the field will have different values for each record. Is it possible to update 
the table with lots of different values?

So for example we have:

Field Qantity
Book 1 5
Book2 6
Book3 9

Now when we are shown all these records the quantity is a form field and we want to 
change this but for each record?

Hope the above is enough to go on.

Barry

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Can Anyone Spare A Few Minutes

2002-04-16 Thread Bzdpltd

Hi there all,

I wonder if there are any people on this list who have much experience using sessions.

We have a catalogue, and I have never used sessions before, and finding it very 
difficult to complete this project.

If there is anyone who could possibly spare some time, I would most appreciate it, as 
I am going nuts on this problem.

I will explain off the list what the problems are. So if there is anyone who could 
possibly help please email me at : [EMAIL PROTECTED]

Many thanks

Scott

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] SID

2002-04-12 Thread Bzdpltd

Hi list,

Wonder if someone could assist me in Enabling Trans SIDs.

I know how to use them, but just dont know the telnet command to enable them.

If someone could tell me exactly what I need to do in order to have them enabled it 
would be much appreciated.

Many thanks

Barry Zimmerman
www.bzdpltd.co.uk

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] AOL Problems

2002-04-09 Thread Bzdpltd

Hi group,

I wonder if anyone can help me with some problems I have just found out with a website 
we have just put together.

Our client unfortuntately uses the AOL browser on a MAC, so he is running version 5 of 
AOL for the mac.

Now we have a database driven website we have put together, and the problem occurs as 
the values do not seem to be getting sent to the database and so therefore he is not 
getting the correct results that he should be.

We have a bookstore, where you intially select your location in the world, and then 
also a category to select the books.

This is fine as it queries the database and returns the results to him. Then on the 
results page we have the category list so that they can go to another category, they 
do not have to select a new location as the values are already carried over each page. 
But what happens is that when they choose the new category and click submit, it does 
not change anything on the page, so they get the same results even though they have 
sent a new value to the server.

Has anybody had this problem, and is there a fix?

Help would be appreciated as this is the last problem we have to fix before this site 
can go live.

Many thanks


Barry Zimmerman
www.bzdpltd.co.uk

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Re: [PHP-DB] Updating Forms Values

2002-04-04 Thread Bzdpltd

Hi there again.
I have tried using the urlencode method but for some reason it is still doing
the same thing and stripping the rest of the name.

I will try to explain more how this works.

I have a site where you login using a name and passord. These values are
stored using cookies and we have the cookie script on each page before the
headers to check to see if the user is allowed at the page there are trying
to access.

This is working fine until we come to editing or adding records.

What happens is the name is tagged onto the standard url links on each page.
So therefore knowing what records to show according to which user is logged
into the system.

Now I have tried using the urlencode but for some reason it just does not
seem to work.

Basically when the user of the system adds or edits a new record, once they
click submit and are taken to the next page which either updates or adds the
new entry, the links which takes them back to the start of the system loses
the end of there name as there is a a space between there first and second
name. 

I have pasted the code which updates the record in the database, together
with some of the other code on the page.

The cookie is at the top and if you look at the link to go back to the index
it contains a urlencode there.

I hope someone can help as I am pulling my hair on this one.

Many thanks
Barry
*
?
if ($name == $name) {
 $msg = PWelcome to secret page A, authorized user!/p;
 
} else {
 header(Location: http://*/administration/error.php;);
 exit;
}
?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
HTML
HEAD
TITLEedited/TITLE
META NAME=GENERATOR CONTENT=Freeway 3.1
STYLE TYPE=text/css
!--
style6 { margin-top: 0px; }
style3 { font-size: 10px; }
--
/STYLE
/HEAD
BODY TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0 MARGINWIDTH=0
BGCOLOR=#ffCENTER
TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=693
TR VALIGN=TOP
TD COLSPAN=3/TD
TD HEIGHT=8/TD
/TR
TR VALIGN=TOP
TD ROWSPAN=3
TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=312
TR VALIGN=TOP
TD ROWSPAN=2IMG SRC=../../Resources/ip20tm.gif BORDER=0
WIDTH=90 HEIGHT=39 ALT=/TD
TD COLSPAN=2/TD
TD HEIGHT=22/TD
/TR
TR VALIGN=TOP
TD/TD
TDIMG SRC=../../Resources/admintitle.gif BORDER=0
WIDTH=209 HEIGHT=17 ALT=/TD
TD HEIGHT=17/TD
/TR
TR
TD WIDTH=90IMG SRC=../../Resources/_clear.gif BORDER=0
WIDTH=90 HEIGHT=1 ALT=/TD
TD WIDTH=12IMG SRC=../../Resources/_clear.gif BORDER=0
WIDTH=12 HEIGHT=1 ALT=/TD
TD WIDTH=209IMG SRC=../../Resources/_clear.gif BORDER=0
WIDTH=209 HEIGHT=1 ALT=/TD
TD WIDTH=1 HEIGHT=1IMG SRC=../../Resources/_clear.gif
BORDER=0 WIDTH=1 HEIGHT=1 ALT=/TD
/TR
/TABLE
/TD
TD COLSPAN=2/TD
TD HEIGHT=26/TD
/TR
TR VALIGN=TOP
TD/TD
TD
P CLASS=style6 ALIGN=RIGHTFONT FACE=Verdana, Arial
SIZE=2SPAN CLASS=style3| /SPAN/FONTA
HREF=../index.php?name=? echo urlencode($name); ?FONT
FACE=Verdana, Arial SIZE=2SPAN CLASS=style3back to my
clients/SPAN/FONT/AFONT FACE=Verdana, Arial SIZE=2SPAN
CLASS=style3 | /SPAN/FONTA HREF=../../index.php 
TARGET=_selfFONT FACE=Verdana, Arial SIZE=2SPAN
CLASS=style3log out/SPAN/FONT/AFONT FACE=Verdana, Arial
SIZE=2SPAN CLASS=style3 |/SPAN/FONT/P/TD
TD HEIGHT=13/TD
/TR
TR VALIGN=TOP
TD COLSPAN=2/TD
TD HEIGHT=1/TD
/TR
TR
TD WIDTH=312IMG SRC=../../Resources/_clear.gif BORDER=0
WIDTH=312 HEIGHT=1 ALT=/TD
TD WIDTH=8IMG SRC=../../Resources/_clear.gif BORDER=0 WIDTH=8
HEIGHT=1 ALT=/TD
TD WIDTH=371IMG SRC=../../Resources/_clear.gif BORDER=0
WIDTH=371 HEIGHT=1 ALT=/TD
TD WIDTH=2 HEIGHT=1IMG SRC=../../Resources/_clear.gif BORDER=0
WIDTH=2 HEIGHT=1 ALT=/TD
/TR
/TABLE
TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=693
TR VALIGN=TOP
TD/TD
TD HEIGHT=6/TD
/TR
TR VALIGN=TOP
TD?php
// create connection
$connection = mysql_connect(*,*,*)
 or die(Couldn't make connection.);
// select database
$db = mysql_select_db(*, $connection)
 or die(Couldn't select database.);
?
?
 
   if ($REQUEST_METHOD==POST) {
# setup SQL statement
$SQL =  UPDATE case_study SET;
$SQL = $SQL .  clientname = '$clientname', ;
$SQL = $SQL .  activity = '$activity', ;
$SQL = $SQL .  title = '$title', ;
$SQL = $SQL .  brief = '$brief', ;
$SQL = $SQL .  solution = '$solution', ;
$SQL = $SQL .  result = '$result' ;
$SQL = $SQL .  WHERE id = '$id' ;
#execute SQL statement
$result = mysql_db_query( inpress,$SQL,$connection );
# check for error
if (!$result) { echo(ERROR:  . mysql_error() . \n$SQL\n);}
echo (P ALIGN=CENTERFONT FACE=\Verdana\SPAN

[PHP-DB] PHP and HTML problems

2002-03-21 Thread Bzdpltd

HI People,

I do not use dreamweaver normally, but have to do a few changes and add some php code 
to this site.

I wonder if someone could quickly look at the attached php page, and look at the 
navigation i use and see why it is looping within the html. Basicall I need the 
records to look but not the next and previous section for the navigation. 

If someone could let me know where I am going wrong, as its urgent. It is the html 
formatting that I think I cannot quite get to grips with. 

Thanks

Barry



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Drop Down Menus

2002-02-12 Thread Bzdpltd

Hi wonder if anyone knows what I am doing wrong here.

I have a drop down selection menu that is generated from a mysql database. In the 
database we have over 15 fields one of them contains text for the catergory that the 
entry belongs to. I have used the following code to generate my drop down menu but 
when i view it in the browser the drop down menu has not listed the categories instead 
we have blank entries for each selection.

? mysql_connect(localhost,user,password);
mysql_select_db(database);
$sql = select distinct category from books ORDER BY category ASC;
$makes_result = mysql_query($sql);
print (select name=\category\\n);
print(option selected value=\\Please select a Category/option\n);
while($row = mysql_fetch_row($makes_result)) 
{
print(option value=\$row[1]\$row[1]/option\n);
}
print(/select); ?

Thanks for the help.

Barry

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Forms carrying values.

2002-02-11 Thread Bzdpltd

Hi list, hope someone can help me here.

I have content management system I have designed. I am still learning php so help here 
would be appreciated.

The user logs into the system, and we carry there user name over the pages using a 
link to each page with the value of their name carried over as follows: 
../index.php?name=?echo($name)?

This works fine for the whole site, except when a user makes changes to a entry. Once 
they submit adding a new entry or modifying an existing one, the value of : 
../index.php?name=My Name ends up being ./index.php?name=My 

It deletes the end of the name of the url, so that when the user clicks the link it 
does not really know who they are.

I have used a hidden field to carry the value of the name over the pages, but it does 
not work on forms.

I hope this makes some sort of sense.

If anyone knows of a workaround.

Thanks

Barry 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Database query

2001-12-18 Thread Bzdpltd

Hi group,

I am still getting to grips with PHP and MySQL and have a question that hopefully 
someone can easily answer:

I have a search page which consists of two drop down menus, the user has 3 ways of 
finding information.

The first is by selecting a location and a discipline which would look in the database 
and return any entries with the data in the two seperate fields.

The second is where they can select the location only, and this will return all 
entries with that location

The third is where they can select the discipline only, and again this will return all 
entries with that discipline.

The problem I have is when the user selects the location and a discipline which should 
return no results as it is not an exact match it is returning results as it contains 
part of the information.

My sql query is as follows: $sql = SELECT * FROM vacancy WHERE ('$related_discipline' 
= related_discipline and '$location' = location) or ('$related_discipline' = 
related_discipline) or ('$location' = location) ORDER BY ID LIMIT $limitvalue1, 
$limit; 

Could someone tell me what I need to change?

Again help is always appreciated.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Assistance Urgent.

2001-12-12 Thread Bzdpltd

Hi I am new to this list and need some help with PHP and MYSQL.

We have a database that has lots of fields in the table. What we are trying to do is 
get specific results, i will explain.

Basicall we need to be able to retrieve the total number of records in the database 
but for individual entries.

We have a field named: related_discipline which contains 1 of 12 different 
disciplines. So for example we have Rail which could be in the field, or Utilities and 
so on.. what we need to do is know how many of each there are in the database, I am 
still developing my knowledge of PHP and MySql so help would be appreciated. We need 
to be able to display the 12 different options that could be in that field in the 
database and how many entries there are for each option.

I would truly appreciate if someone could assist me here.

With kindest regards


Barry Zimmerman

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]