Re: [PHP-DB] PHP + MySQL

2007-07-18 Thread Dimiter Ivanov

On 7/18/07, Dan Maret [EMAIL PROTECTED] wrote:

I just can't figure it out and Google yielded no help. I have a table named
'settings' which contains two fields, 'item' and 'content'.  What I would
like to do is grab that data and use the 'item' field as the name, and use
the respective 'content' as the value in an array.  For Example:

Array (
copyright = Copyright 2007 yada yada
version =  2.15.1
)

That way I can do ?= $settings['version'] ?

Can you help point me in the right direction?  Any help would be greatly
appreciated!! :-D

--
-Dan



You need mysql_fetch_assoc()  / mysql_fetch_array() functions
http://www.php.net/mysql_fetch_assoc
http://www.php.net/manual/en/function.mysql-fetch-array.php

They come with a good examples in the manual pages.

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



Re: [PHP-DB] Installing PHP 5.2.2 in Windows XP

2007-05-21 Thread Dimiter Ivanov

On 5/21/07, Abdul Rahman Riza [EMAIL PROTECTED] wrote:

Dear Folks,

  I need your assistant how to install PHP 5.2.2 with apache web server 2.2.4 
in Windows XP environment?

  Many thanks for you help,
  Riza



http://www.wampserver.com/en/

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



Re: [PHP-DB] $_POST[mypassword]; ***Undefined index: mypassword

2007-05-14 Thread Dimiter Ivanov

On 5/14/07, Chetanji [EMAIL PROTECTED] wrote:


I corrected a small spelling error to make the situation more understandable.
Everything is the same I am stuck!
Thanks in Advance, Chetanji

Chetanji wrote:



 All the errors are gone but this nagging one.  I am running a login script
 and getting this error...

 To bring the username and password into the processing script I am doing
 it this way, and having trouble.
 I have spent too many hours working on this one issue.  Please help
 someone.
 Blessings, Chetan

 $myusername=$_POST[myusername];
 $mypassword=$_POST[mypassword];

 
::
 Notice: Undefined index: myusername in
 C:\Inetpub\wwwroot\AimsSite\docproedit\login.php on line 13

 Notice: Undefined index: mypassword in
 C:\Inetpub\wwwroot\AimsSite\docproedit\login.php on line 13



Those messages mean that the variables $_POST[myusername] and
$_POST[mypassword]; are not set.
Try dumping the $_POST array var_dump($_POST); , to see what is in
there, before you assign the values to $mypassword and $myusername.

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



Re: [PHP-DB] $_POST[mypassword]; ***Undefined index: mypassword

2007-05-14 Thread Dimiter Ivanov

On 5/14/07, Chetanji [EMAIL PROTECTED] wrote:


Thanks for the reply,  this is the only output before and after the
$_POST

  array(0) { } ..that's it

I still have the two Notice's from PHP.
But the program works otherwise, in checking the DB for the hashed
password...
that matches the typed in username ...
that is then hashed itself
in the login.php program.
It works and doesn't 'auth' for incorrect user/pass combinations.
However, I do not like running programs that kick out 'errors' of any kind.
It seems to always lead to unpredictable situations that are a problem.
Any other ideas?
Thanks,
Chetanji


Well then the $_POST array is empty that's why you have those notices.
The $_POST array is populated with values ONLY after the form was
submitted to the login.php script.
If you use this script before the form was submitted or in any other
context, then you will get those notices.

If you check if the variables you are looking for are set, before
assigning them, you will not get the notices.

Try this:
if(isset($_POST[myusername] AND isset($_POST[mypassword])){
$myusername=$_POST[myusername];
$mypassword=$_POST[mypassword];
}

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



Re: [PHP-DB] $_POST[mypassword]; ***Undefined index: mypassword

2007-05-14 Thread Dimiter Ivanov

On 5/14/07, Chetanji [EMAIL PROTECTED] wrote:


Okay, now with the isset and var_dump in place within the login.php script,
I get the output of what I typed into the Log On page.
All this output is 'premeal' for the login.php script.

So then the PHP Notice's are just something to know the PHP parser is
seeing a empty, undescriptive container and is throwing a hey, look at this
it may not be normal when the login.php script is run by itself in the
browser.  You are thinking its not a problem and will not lead to any
problems.  If this is the case then thankyou Dimiter.
Blessings,
Chetanji


Yes that's the purpose of notices.

From the php manual :


Run-time notices. Indicate that the script encountered something that
could indicate an error, but could also happen in the normal course of
running a script.

http://www.php.net/manual/en/ref.errorfunc.php#e-notice

You may comment/remove the var_dump, it's only for debugging purposes.
You don't need it anymore.

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



Re: [PHP-DB] mysql question.

2007-04-03 Thread Dimiter Ivanov

On 4/3/07, Me2resh Lists [EMAIL PROTECTED] wrote:

hi
i need help regarding a sql query in my php app.

the query is :
$SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
LIMIT $startingID,$items_numbers_list;

i want to sort this query by the number of the repeated EMail counts.
can anyone help me with that please ?



$SQL = SELECT EMail,count(EMail) AS repeated FROM mena_guests WHERE
Voted = 'yes' GROUP BY EMail ORDER BY count(EMail)  LIMIT
$startingID,$items_numbers_list;

I can't remember if in the order clause you can order by the alias of
the field or using the count again, test it to see what's the proper
syntax

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



Re: [PHP-DB] widthheight already solved

2007-03-31 Thread Dimiter Ivanov

On 3/31/07, elk dolk [EMAIL PROTECTED] wrote:

thank you all this code solved it:

?php echo img src='/album/img/{$photoFileName[2]}' width='60' height='70' border='0' 
/ ;?

-
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.


I liked that you moved the list a bit.
But your problem was more related to the php-general list or by simply
reading the  manual.

http://php.net/echo

Before sending a mail to a thousands of people, you should at least
read the manual.

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



Re: [PHP-DB] echo

2007-03-28 Thread Dimiter Ivanov

something like this : Inetpub\wwwroot\album\img
as I am running out of time! could someone complete this code just with one 
echo and img src so that I can retrive my photos ?

MySQL columns : photoID=seq number
photoFileName=name of my photo like 
3sw.jpg
 title=title
 description=short description


?php

$link = mysql_connect('localhost', 'root', 'pw');
if (!$link) {
die('Not connected : ' . mysql_error());
}

$db_selected = mysql_select_db('album', $link);

$query = SELECT * FROM photo;
$result=mysql_query($query);

while ($row = mysql_fetch_array($result))
{
echo???

}

mysql_free_result($result);

?



The path would be relative to your web root folder.

in your case
img src=/album/img/image_name

or if you are testing on your own machine use
img src=http://localhost/album/img/image_name;
or if you need it to work for outside connections :
img src=http://your_ip_addres/album/img/image_name;

i suggest using the relative path.

while ($row = mysql_fetch_array($result)) {
 echo img src='/album/img/.$row[photoFileName].' /
}

P.S.

Chris sorry for accidentaly sending it only to you the first time..

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



Re: [PHP-DB] Re: do not display dublicated entries

2007-03-16 Thread Dimiter Ivanov

On 3/14/07, Niel Archer [EMAIL PROTECTED] wrote:

Hi

 I have tried everything except of the one that forms the date in one field
 and use the DISTINCT for ip and date.

It works for me. I use it for essentially the same job, listing most
recent visit to a location (not IP, but physical venue).

Have you tried adapting it to your needs, such as:
$query = SELECT DISTINCT ip, day, month, year FROM tracker WHERE page = 
'index'  ORDER
BY `tracker`.`year` DESC , `tracker`.`month` DESC , `tracker`.`day` DESC LIMIT 0, 
20;


Niel

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




try grouping by IP and selecting the max date value
SELECT IP,max(date) AS latestvisit FROM table GROUP BY IP

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



Re: [PHP-DB] problem with header()

2006-10-04 Thread Dimiter Ivanov

On 10/4/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hi

I can not submit any header() information in the following context.
What is wrong within the code?

?php

require_once  includes/db.inc;
require_once HTML/Template/ITX.php;

if (!($connection = @ mysql_connect($hostname, $username, $password)))
   die(Could not connect to database);

$status = mysqlclean($_GET, status, 1, $connection);
$template = new HTML_Template_ITX(./templates);
$template-loadTemplatefile(form2tpl.tpl, true, true);


$template-setCurrentBlock(success);
$template-setVariable(AUTOR, $_REQUEST[autor_eb]);
$template-setVariable(STICHWORT, $_REQUEST[stichwort_eb]);
$template-setVariable(DATUM, $_REQUEST[datum_eb]);
$template-setVariable(ANLAGE, $_REQUEST[anlage_eb]);
$template-setVariable(PROBLEM, $_REQUEST[problem_eb]);
$template-parseCurrentBlock();
$template-show();


session_start();

foreach($_POST as $Key = $Value) {
$_SESSION[$Key] = $Value;
}

if ($_POST['submit'] == Eintrag Bearbeiten){
   header(Location: http://127.0.0.1/www2/knowledge_db/knowbase02.php;);
   exit;
}
?

Best regards, Joerg Kuehne


There must be NO output to the user, before any header(); calls.
1) Check the files you require() for any whitespaces before the ? tag
2) IF $template-show(); does what it says, you must start the session
before that call.
3) Good luck :)

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



Re: [PHP-DB] Help displaying Column Names

2006-09-14 Thread Dimiter Ivanov

On 9/14/06, Miguel Guirao [EMAIL PROTECTED] wrote:



You haven't searched at all, go to www.php.net and look up for
mysql_field_name() and related functions!!

-Original Message-
From: Grant Griffith [mailto:[EMAIL PROTECTED]
Sent: Jueves, 14 de Septiembre de 2006 10:22 a.m.
To: php-db@lists.php.net
Subject: [PHP-DB] Help displaying Column Names


Hello All,



I am fairly new to PHP but have coded in asp and asp.net for years.  I
am trying to find the code that will allow me to display the name of the
column's from the table I am using.  Below is the code where I am
writing all the data out in a comma delimited fashion, but I want to
make the very first row show the name of the database table names.  For
example I want to show the ID,Name,Address, etc...



Can someone tell me what that command is in PHP?  I have searched and
can not find anything, I guess I am searching for the wrong info as I
know it can be done!!!



This functionality is related to the database you are using. Thus you
have to look into the functions that PHP provides for this database.

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



Re: [PHP-DB] Populating an array to the next script!

2006-07-07 Thread Dimiter Ivanov

On 7/7/06, Miguel Guirao [EMAIL PROTECTED] wrote:



Hello,

Is there a way to populate an array from one script to the next one?
I'm using a form, and a hidden field for such desire:

input name=hwt[] type=hidden value=?php echo($hwGSM);?

but it returns this:

input name=hwt[] type=hidden value=Array

then I pretend to read the array again at the target script by coding the 
following:

$hw=$_POST['hwt'];
$hwGSM=$hw[0];
for($i=0;$i=$maxpoint;$i++){
echo($hwGSM[$i]);
}

It should be pretty easy but I have not done it ever!

Regards,
Miguel Guirao


You have to make inputs for every element of the array. something like this :

foreach($hwGSM AS $key = $value){
echo input name='hwt[$key]' type=hidden value='$value'
}

And then after the submit you will have your array $hwt. PHP will make
an array out of all that inputs.

Another option you can use if you want a single input is to serialize
the array, on the form, and then unserialize it in the script
processing the form.

http://bg2.php.net/manual/en/function.serialize.php
http://bg2.php.net/manual/en/function.unserialize.php

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



Re: [PHP-DB] Chinese characters

2006-06-07 Thread Dimiter Ivanov

On 6/7/06, Jeffrey [EMAIL PROTECTED] wrote:

John Meyer wrote:
 Is there any way to filter out Chinese or Asian characters from what I
 get from this list?  I understand that there are a lot of intelligent,
 well-meaning Asians on this list but my system seems to get Montezuma's
 revenge when I look at those e-mails.

FWIW: The posts with Chinese and Japanese characters are not even posts.
They are pure spam. As such, the senders should be removed from the list
completely.

Jeffrey

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




Yes, what's with all this spam, nearly 50% of the messages i get from
PHP-DB are with ?some english word?
PHP-GENERAL doesn't get even one message like that...
Asian spammers are mad at PHP-DB ?

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