Re: [PHP-DB] Random pick

2010-01-25 Thread Olavi Ivask

Hi,

did you mean something like this?

$level_names = array(Guest, Regular User, Intl. User,  
Contractor, Employee,

Sales, Investor, Human Resources, 
Administrator);

$user_level = $level_names[$req_user_level];

Regards,
Olavi Ivask


On Jan 25, 2010, at 9:13 PM, Karl DeSaulniers wrote:


Hello List,
Trying to learn the right way to code this line.
Can anyone tell me if I am doing this the right way?

if $req_user_level == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 ||  
9 ? Guest || Regular User || Intl. User || Contractor ||  
Employee || Sales || Investor || Human Resources ||  
Administrator;


I am wanting to stray from the if(foo == bar) { routine. ;)

Thanks,

Karl DeSaulniers
Design Drumm
http://designdrumm.com




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



Re: [PHP-DB] Random pick

2010-01-25 Thread Olavi Ivask

Don't you like my solution?

Regards,
Olavi

On Jan 25, 2010, at 9:39 PM, Karl DeSaulniers wrote:


Hi,
$req_user_level is a MySql return result and I am trying to utilize  
shortened code to evaluate whither $req_user_level == 0 || 1 || 2 ||  
3 || 4 || 5 || 6 || 7 || 8 || 9, if it matches a number, return the  
text associated with that number.
Guest || Regular User || Intl. User || Contractor ||  
Employee || Sales || Investor || Human Resources ||  
Administrator;


Karl


On Jan 25, 2010, at 1:31 PM, Olavi Ivask wrote:


Hi,

did you mean something like this?

$level_names = array(Guest, Regular User, Intl. User,  
Contractor, Employee,

Sales, Investor, Human Resources, 
Administrator);

$user_level = $level_names[$req_user_level];

Regards,
Olavi Ivask


On Jan 25, 2010, at 9:13 PM, Karl DeSaulniers wrote:


Hello List,
Trying to learn the right way to code this line.
Can anyone tell me if I am doing this the right way?

if $req_user_level == 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 ||  
9 ? Guest || Regular User || Intl. User || Contractor ||  
Employee || Sales || Investor || Human Resources ||  
Administrator;


I am wanting to stray from the if(foo == bar) { routine. ;)

Thanks,

Karl DeSaulniers
Design Drumm
http://designdrumm.com





Karl DeSaulniers
Design Drumm
http://designdrumm.com




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



Re: [PHP-DB] String manipulation

2009-09-11 Thread olavi
You can do like this:

$str = 'helloworld';

echo preg_replace('//', ' ', $str);

this will print out  - h e l l o w o r l d

Olavi Ivask

 How would I put a space after each letter:

 echo str_shuffle(stripslashes(mysql_result($word_result,0,word));

 Ron



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



Re: [PHP-DB] PHP to MS SQL Package

2008-06-12 Thread Olavi ivask
Hi,

you need to install freetds before compiling php.

compile php:

./configure [--with-apxs --with-mysql...]
--with-sybase=/usr/local/freetds
make 
make install

Olavi Ivask

On Thu, 2008-06-12 at 12:14 -0400, Wei, Alice J. wrote:
 Hi,
 
   I am currently using a Linux box with Fedora 9.0 and I am trying to connect 
 PHP to a MS SQL database. All the permissions on the MS SQL database is up to 
 date and accurate, but I consistently get errors that say
 
 PHP Fatal error:  Call to undefined function mssql_connect() in 
 /usr/local/apache/htdocs/create_new_entry_master.php on line 20
 
 I have looked into the options of using FreeBSD, as suggested on the 
 http://us3.php.net/manual/en/function.mssql-connect.php#83196,  but I am not 
 sure if I could use it since I don't use a Windows Machine to run my PHP.
 Does anyone have any suggestions?
 
 Alice
 ==
 Alice Wei
 MIS 2009
 School of Library and Information Science
 Indiana University Bloomington
 [EMAIL PROTECTED]
 


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



RE: [PHP-DB] PHP to MS SQL Package

2008-06-12 Thread Olavi ivask
Hello,

Here is a good article about ms-sql  PHP on Linux
(http://www.devarticles.com/index2.php?option=contenttask=viewid=667pop=1page=0hide_js=1)


Olavi Ivask
On Thu, 2008-06-12 at 13:43 -0400, Wei, Alice J. wrote:
 Hi,
 
   After stopping the Apache server, I reinstalled PHP by adding the line you 
 had below, and then restarted Apache.
 
 ./configure
 --with-apxs2=/usr/local/apache/bin/apxs  \
 --with-sybase=/usr/local/freetds
 --prefix=/usr/local/apache/php \
 make
 make install
 
   After this has been completed, I am still getting the same error about how 
 the function is not defined.
 
 Fatal error:  Call to undefined function mssql_connect() in 
 /usr/local/apache/htdocs/create_new_entry_master.php on line 20
 
 Could there be other options? Or, am I missing something here?
 
 Alice
 ==
 Alice Wei
 MIS 2009
 School of Library and Information Science
 Indiana University Bloomington
 [EMAIL PROTECTED]
 
 From: Olavi ivask [EMAIL PROTECTED]
 Sent: Thursday, June 12, 2008 12:57 PM
 To: Wei, Alice J.
 Cc: php-db@lists.php.net
 Subject: Re: [PHP-DB] PHP to MS SQL Package
 
 Hi,
 
 you need to install freetds before compiling php.
 
 compile php:
 
 ./configure [--with-apxs --with-mysql...]
 --with-sybase=/usr/local/freetds
 make
 make install
 
 Olavi Ivask
 
 On Thu, 2008-06-12 at 12:14 -0400, Wei, Alice J. wrote:
  Hi,
 
I am currently using a Linux box with Fedora 9.0 and I am trying to 
  connect PHP to a MS SQL database. All the permissions on the MS SQL 
  database is up to date and accurate, but I consistently get errors that say
 
  PHP Fatal error:  Call to undefined function mssql_connect() in 
  /usr/local/apache/htdocs/create_new_entry_master.php on line 20
 
  I have looked into the options of using FreeBSD, as suggested on the 
  http://us3.php.net/manual/en/function.mssql-connect.php#83196,  but I am 
  not sure if I could use it since I don't use a Windows Machine to run my 
  PHP.
  Does anyone have any suggestions?
 
  Alice
  ==
  Alice Wei
  MIS 2009
  School of Library and Information Science
  Indiana University Bloomington
  [EMAIL PROTECTED]
 
 
 


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



Re: [PHP-DB] basic form entry

2007-10-07 Thread Olavi Ivask
INSERT inserts new data to database. If you want to update data, use
UPDATE instead of INSERT.

Olavi Ivask
I have been racking my brains trying to figure out what I am doing wrong.
 i
 have created a basic form that calls requests user information...the form
 then runs insert.php.  No errors are returned, however, my database does
 not
 update.  Any suggestions? thanks

 The field names in the table are correct (case).


 SUBMIT.HTML:

 form action=insert.php method=post
 First Name: input type=text name=firstbr
 Last Name: input type=text name=lastbr
 Phone: input type=text name=phonebr
 Mobile: input type=text name=mobilebr
 E-mail: input type=text name=emailbr
 Web: input type=text name=webbr

 input type=Submit value=click para enviar

 /form


 INSERT.PHP

 ? php
 echohello
 $username = guest;
 $psswd = password;
 $db = contacts;
 $host = localhost;

 $first_name = $_POST['first'];
 $last = $_POST['last'];
 $phone = $_POST['phone'];
 $mobile = $_POST['mobile'];
 $email = $_POST['email'];
 $web = $_POST['web'];

 mysql_connect($host,$username,$psswd) or die (errror in access db);
 mysql_select_db($db);




 mysql_query (INSERT INTO users (First,Last,Phone,Mobile,Email,Web) VALUES
 ('$first_name','$last','$phone,'$mobile','$email','$web') );

 echo('$username','$last')

 echo mysql_error(mysql_connect($host,$username,$psswd));

 ?

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



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



Re: [PHP-DB] tables

2007-03-30 Thread olavi
I think it should be something like this:

 table width=50% border=0 cellspacing=3 cellpadding=0
   tr
 td?php echo img src='/album/img/.$photoFileName[2].'/ ;
 ?/td
 td?php echo img src='/album/img/.$photoFileName[3].'/ ;
 ?/td
   /tr
   tr
 tdnbsp;/td
 td?php echo img src='/album/img/.$photoFileName[0].'/ ;
 ?/td
   /tr
 /table
how many pictures do you have in database?
dont u want to use for/while ?

Olavi Ivask

 -
 TV dinner still cooling?
 Check out Tonight's Picks on Yahoo! TV.

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