[PHP-DB] Re: Help: Two dimensional array from table

2006-04-09 Thread El Bekko

Mark Fellowes wrote:

I created an array to pull data out of one column in database.

  ?php 
//Code for registered

$usrregid = array();
do {
 $usrregid[] = $row_rs_usr_usr[usr_id];
} while($row_rs_usr_usr = mysql_fetch_assoc($rs_usr_usr));
//end of registered
?

However I now need a second column from the table and think a two dimensional 
array is the right way to go. Having a problem though in defining.  Most of the 
examples I found don't seem to apply to pulling the values from a db.

I tried this and while it returns no errors, it also returns no value.

?php 
//Code for registered

$usrreg = array(id, date);
do {
 $usrreg[] = $row_rs_usr_usr[usr_id][usr_date];
} while($row_rs_usr_usr = mysql_fetch_assoc($rs_usr_usr));
//end of registered
?

Am I defining wrong or pulling the values wrong ?

TIA
Mark
__
Organize. Communicate. Share. @ http://www.goowy.com


Maybe try it this way:


?php
//Code for registered
$usrreg = array(id, date);
do {
   $usrreg[][id] = $row_rs_usr_usr[usr_id]
   $userrag[date] = $row_rs_usr_usr[usr_date];
} while($row_rs_usr_usr = mysql_fetch_assoc($rs_usr_usr));
//end of registered
?

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



[PHP-DB] Re: stripslashes etc.

2006-03-02 Thread El Bekko

Andrew Darby wrote:

Hello, all.  I'm getting a bit confused figuring out the best way to
insert data into a db via web forms and then pull it out again safely.
 I know there's lots of information out there, but I was hoping
someone could suggest a current, [easy!] best practice.  Specifically,
I have the following surely common set of situations:

1.  user submits info to db
 --how best to screen out html / escape special characters on insert

2.  info is publicly displayed
 -- how best to unescape special characters for display

3.  user edits their submission in form populated with their existing data
 --again, to screen, but not have the escape characters multiply crazily

4.  user updates db
 --again, without additional of exciting new escape characters

I'm getting a bit mixed up through all the stages, and if someone
would take pity and walk me through this, I, um, would thank you
sincerely.

TIA,

Andrew

When inserting, use this:

?php
$text = addslashes(htmlspecialchars($text));
?

When extracting, use this:

?php
$text = stripslashes($text);
?

htmlspecialchars does this:

  '' (ampersand) becomes 'amp;'

  '' (double quote) becomes 'quot;' when ENT_NOQUOTES is not set.

  ''' (single quote) becomes '#039;' only when ENT_QUOTES is set.

  '' (less than) becomes 'lt;'

  '' (greater than) becomes 'gt;'

addslashes does this:

Returns a string with backslashes before characters that need to be 
quoted in database queries etc. These characters are single quote ('), 
double quote (), backslash (\) and NUL (the NULL byte).


stripslashes strips all slashes added by addslashes.

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



[PHP-DB] Re: Help Needed with malfunctioning query

2006-02-26 Thread El Bekko

Chris Payne wrote:

Hi there everyone,
 
This line of code USED TO WORK but now it gives me a Coudln't Execute Query

error:
 
$query2 = SELECT word,def,photo MATCH(word,def) AGAINST ('$txtsearchword'

IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST
('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage;

I tried it with a basic $query2 = SELECT * FROM dictionary; to make sure
it wasn't something else that was broke and this is the problem above, it
used to work great and now it's on a live site after working great for 6
months and it suddenly doesn't work and I haven't touched anything !!!  the
server hasn't been updated so it's not that as it also does the same on my
local dev machine here, the only thing that happened was my co-worker did a
global find and replace with dreamweaver but that's all and I can't
personally see anything wrong with the above though I could be looking too
hard.
 
Any help would REALLY be appreciated as this is on a very popular website

and needs fixing ASAP so I don't lose my head !!!
 
Chris




I tested your SQL on
http://developer.mimer.com/validator/parser200x/index.tml#parser
and got this:



Result:
SELECT word,def,photo MATCH(word,def) AGAINST ('$txtsearchword'
^   ^
syntax error: ,
  correction: JOIN identifier ON identifier ) ,
syntax error: )
  correction: =

IN BOOLEAN MODE) AS m FROM dictionary WHERE MATCH(word,def) AGAINST
   ^--^---  ^   ^--
syntax error: BOOLEAN
  correction: (
syntax error: FROM
  correction: ) FROM
syntax error: MATCH
  correction: identifier
syntax error: ) AGAINST
  correction: = AGAINST

('$txtsearchword' IN BOOLEAN MODE) LIMIT $offset, $item_perpage
 ^--   ^  ^
syntax error: BOOLEAN
  correction: (
syntax error: LIMIT $ offset ,
  correction: ,
syntax error: $ item_perpage
  correction: item_perpage


^
syntax error: end
expected: ( ) * + , - - . / ::  =  =  = [ || AND AS AT BETWEEN
  COLLATE DAY HOUR IN IS LIKE MATCH MEMBER MINUTE MONTH 
MULTISET

  NOT OR OVERLAPS SECOND SIMILAR SUBMULTISET YEAR
  correction: ) ) end



Hope it helps :)

-- Bekko

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



[PHP-DB] Re: cannot connect to mysql on windows

2006-02-25 Thread El Bekko

raj wrote:

Hello,

I have apache 2 and mysql 4.1 and php5 and am unable to connect to mysql 
database server, and keep getting the following error:


Fatal error: Call to undefined function mysql_connect() in 
D:\backup\test.php on line 10


I have removed the semicolon before the line:

extension=php_mysql.dll

I do have the extension at C:/php/ext/
also,  I even have the server running but no luck.

Please help.

Raj

Does it include MySQL information when phpinfo(); is called?

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



[PHP-DB] Re: Help need please?

2006-01-22 Thread El Bekko

JeRRy wrote:

Hi,
   
  I know this is not PHP/MySQl related but every other board I have posted on I have not got a response, so I'll try here also.  I'm missing something basic, surely here so that is another reason I am posting here..
   
  Here goes...
   
  I have two lots of code here, one is for a refreshing text code in Javascript and another is a banner refreshing ad system.
   
  Using similiar technequies.
   
  But I can only get the refreshing text to appear but can't get the ads to work on the one page. :(  
   
  But if I add a  in any text area of the text refreshing than the ads system works but the text refreshing don't.  But if I remove the  from any text area the text refreshing works but the ads don't.  I can't seem to find the problem.
   
  Here is the code(s)
   
  ads code
   
  center

  script language=JavaScript1.2
hexinput=255  // Initial color value.
var inc=-1 //increment variable
  function fadingad(){   
if(hexinput0) { 
hexinput-=11; // increase color value

document.getElementById(fader1).style.color=rgb(+hexinput+,+hexinput+,+hexinput+);
 // Set color value.
setTimeout(fadingad(),20); 
}

else
hexinput=255  //reset hex value
}
  function changead(){
if (!document.getElementById) return
inc++
if (inc==0)
document.getElementById(fader1).innerHTML=img src=adtest/b1.jpg
else if (inc==1)
document.getElementById(fader1).innerHTML=img src=adtest/b2.jpg
else if (inc==2)
document.getElementById(fader1).innerHTML=img src=adtest/b3.jpg
else if (inc==3)
document.getElementById(fader1).innerHTML=img src=adtest/b4.jpg
else if (inc==4)
document.getElementById(fader1).innerHTML=img src=adtest/b5.jpg
else if (inc==5)
document.getElementById(fader1).innerHTML=img src=adtest/b6.jpg
else if (inc==6)
document.getElementById(fader1).innerHTML=img src=adtest/b1.jpg
else{
document.getElementById(fader1).innerHTML=img src=adtest/b2.jpg
inc=-1
}
fadingad()
setTimeout(changead(),4000)
}
  window.onload=changead
  /script
  div id=fader1 style=font:18px Arial 
bold;width:100%;color:rgb(255,255,255)/div
  /center
   
  end ads code
   
  text refreshing
   
  script language=JavaScript1.2

hexinput=255  // Initial color value.
var inc=-1 //increment variable
  function fadingtext(){   
if(hexinput0) { 
hexinput-=11; // increase color value

document.getElementById(fader).style.color=rgb(+hexinput+,+hexinput+,+hexinput+);
 // Set color value.
setTimeout(fadingtext(),20); 
}

else
hexinput=255  //reset hex value
}
  function changetext(){
if (!document.getElementById) return
inc++
if (inc==0)
document.getElementById(fader).innerHTML=Soon to be Released
else if (inc==1)
document.getElementById(fader).innerHTML=What you really need to know about 
Testing and Tagging
else if (inc==2)
document.getElementById(fader).innerHTML=250 Pages of jam-packed reality testing 
regimes that will maintain a safer working environment for all
else if (inc==3)
document.getElementById(fader).innerHTML=Learn what's it all about before they 
come and do it for you - A must read for all Clients, Employers, Electricians and Competent 
Persons
else if (inc==4)
document.getElementById(fader).innerHTML=Just when you thought you knew what 
testing and tagging was all about - along comes a book!
else if (inc==5)
document.getElementById(fader).innerHTML=Memberships available
else if (inc==6)
document.getElementById(fader).innerHTML=Are you really doing it right?
else{
document.getElementById(fader).innerHTML=a href=order.phpPre-order/a and 
Save
inc=-1
}
fadingtext()
setTimeout(changetext(),8000)
}
  window.onload=changetext
  /script
  div id=fader style=font:18px Arial 
bold;width:100%;color:rgb(255,255,255)/div

  end of text refreshing
   
  Any help would be awsome, or solutions?
   
  Jerry
   



-
Do you Yahoo!?
  Messenger 7.0: Free worldwide PC to PC calls


This is not at all PHP related.

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



Re: [PHP-DB] Formatting a form box

2006-01-12 Thread El Bekko

Miguel Guirao wrote:


One approach is to ask the user to input a text delimiter, like a @, for
example, in every point where there should be a new line or paragraph.
Then, you should parse the text, and at every point you find a @, tu place
a BR or P or any other HTML tag that best suits your need!!

This is just one solution, but I'm pretty sure there others!!

Mike Guirao

-Original Message-
From: Alex Major [mailto:[EMAIL PROTECTED]
Sent: Jueves, 12 de Enero de 2006 10:33 a.m.
To: php-db@lists.php.net
Subject: [PHP-DB] Formatting a form box


Hi there,
On one of my forms, there is a section where users can put images etc..and
then it is displayed on my php pages. My question is how do I make it so
that the html formatting is automatically done. For example when someone is
typing something, and wants to start a new paragraph although they press
return when typing when the data is displayed from the MySQL database on a
website it's just continuous text. For it to start a new paragraph they have
to put p in when they are typing in this box. They do not know all the
html formatting codes, and so I need someway of making so that it is easy
for them to have formatted text without doing all the html.
Also things like changing colours, bold, italic and things would be good.
Something like on forums, where when you enter a new post you have all the
formatting options.

Hope this makes sense,
Regards,
Alex.

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


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.


The nl2br() function is way better because you don't change email adressess.

And for the colours and stuff... just put a small note on the bottom of 
your post page what HTML tags they are allowed to use.


Greets, El Bekko

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



[PHP-DB] Re: retaining and displaying line returns in a text field

2006-01-08 Thread El Bekko

Frank Flynn wrote:
This is an HTML issue (not PHP or MySQL) that is HTML ignores  carriage 
returns (and most other white spaces).


There are two simple solutions:

use pre tags:

  echo  pre $rmks/pre;

Or replace the \n with br

  $newRmks = str_replace ( \n, br, $rmks );
  echo $newRmks;

You can do this going into or coming out of the database but remember  
to be consistent.  And you can do more with paragraphs and changing  
tabs and other special characters - there are probably some libraries  
that will all this and much more (including some WISIWYG editors that  
you can put on your web page) depending on how deep you want to get.


Good Luck,
Frank

On Jan 6, 2006, at 2:45 PM, [EMAIL PROTECTED] wrote:


From: swoll2 [EMAIL PROTECTED]
Date: January 6, 2006 3:34:52 AM PST
To: php-db@lists.php.net
Subject: retaining and displaying line returns in a text field


Good morning -

I'm trying to get a text field with line returns in it to be stored,
retrieved, and displayed the way it gets entered.

Specifically, my users use a form field (html textarea) to enter some
remarksas they enter their remarks, they can hit Enter to  insert 
a hard

return, which is reflected in the textarea on their screen.

Example entry:
this is line1.
this is line2.
this is line3.

Those remarks get uploaded into a mysql db, into a field defined as  a 
text

field named rmks.

If I use PhpMyAdmin to browse the table, it shows the entry with  the 
lines

separated, but there are no /n's or other control characters visible.

Later, the field is retrieved from the db using a php script and  
assigned to
a variable $rmkswhen I echo $rmks, it displays on a single line  
without

the line returns, like this:

this is line1.this is line2.this is line3.

I have tried to work with addslashes and stripslashes, but neither has
worked.  I think I'm just missing something basic

Appreciate any help or points to previous  
discussions..thanks...Steve








When echoing, use this:

echo nl2br($rmks);

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



[PHP-DB] Re: Bit(1) datatype from mySQL

2006-01-08 Thread El Bekko

Larry Bradley wrote:

Greetings:

I'm new to PHP, although I've been a programmer all my life. I had been 
doing a bit of web database work with VB Script and ASP and mySQL, and 
then decided to try PHP. I've run into a couple of things that bother me.


I have boolean fields (i.e. bit(1)) in the mySQL database. When I 
retrieve data from the mySQL server into an array or an object, it seems 
as if all the data fields are returned as characters. For most data 
types this does not matter, since PHP will handle them properly. This an 
integer 46 being retrieved as a character '46' is OK.


However, the boolean is a curse, as it comes back as a character 
containing hex 00 or hex 01, and I have to use a test such as:


if (ord(IsAMember) == 0) ...

I can't just treat it as a boolean.

I have got around the problem by using a construct such as:

select if(IsAMember,1,0) as IsAMember

in the SQL select, but this is a bit of a pain.

Any thoughts?

Thanks

Larry Bradley
Orleans (Ottawa), Ontario, CANADA


Try using a set() field with values true and false

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



Re: [PHP-DB] isset or ! isset what is my problem?

2006-01-03 Thread El Bekko

On Monday 02 January 2006 7:54 pm, Ralph wrote:


I'm building a URL based on data extracted from mySQL and I want the
text space.gif used as my default value should the variable $picture
by NULL.

The results of the code below kick back a value for $picture when it
is set in the database, but ignores the space.gif if the database
result is empty.

If I flip the test from ! isset to isset then I get the space.gif for
each result.


I've had no luck searching out an answer.

Thanks in advance.

--The Code-
?php do { ?
img src=images/?php
$picture=$row_rst_screenings['Picture'];

if(! isset($picture)) {
$picture='space.gif';
}else{
$picture=$row_rst_screenings['Picture'];
}

echo $picture;

?br
pspan class=style2?php echo $row_rst_screenings['Title']; ?/
spanbr /
span class=style3?php echo $row_rst_screenings['Director']; ?/
span/p
p class=style4?php echo $row_rst_screenings['Blurb']; ?/p
p class=style3Showtime: ?php echo $row_rst_screenings
['ShowTime']; ? ?php echo $row_rst_screenings['ShowDate']; ?/p
p class=style3Location: ?php echo $row_rst_screenings
['Location']; ?/p

?php } while ($row_rst_screenings = mysql_fetch_assoc
($rst_screenings)); ?

---END-


Seeing as you're querying, use mysql_num_rows() to check.

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



[PHP-DB] Re: Inserting a php file into a mysql database

2005-12-26 Thread El Bekko

Thomas Bonham wrote:

Hello,

I am trying to insert a php page into a database. I need to know if 
there is something that I need to do when setting up the table, also is 
there something to do with the code.


Thank You for your help

Thomas


Use file_get_contents() I'd say... but you'll have the problem the file 
executes :S


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



Re: [PHP-DB] Scrolling News

2005-12-24 Thread El Bekko

PHP Superman wrote:

Hi,
just to tell you scrolling text boxes are javascript, PHP is server side not
client side, PHP can only get the data from the table and javascript will
display it



On 12/22/05, Alex Major [EMAIL PROTECTED] wrote:


Hi there.
I'm trying to make a scrolling news box for my website. Basically I would
like this news box to get information from a column in my database called
'news_title' and display it in a scrolling news box.
The reason I'd like it to do this is because there is already a news page
on
my website, which stores 'news_date' ,  'news_poster' ,  'news_title' ,
'news_description' , 'news_content' in a table on my database. I'd just
like
to increase the functionality of this by having this news box on my front
page, which scrolls the 'news_title'.

Any suggestions for how to go about doing this? I'm still very new to php.

Regards,
Alex.

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






--
Hi Everyone, I am running PHP 5 on Windosws XP SP2 with MySQL5, Bye Now!


If you want an easy way of letting text scroll, use marquee tags

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



[PHP-DB] Re: CLOSE button or a href link

2005-12-22 Thread El Bekko

Ron Piggott (PHP) wrote:

I am building a Christian ministry web site.

One of the things we are establishing is an online offering basket to
receive donations.  One of our disbursements is a benevolent fund to
help others.

I have a 'how we operate our benevolent fund' web page online at
http://www.actsministrieschristianevangelism.org/financial/how_we_operate_our_benevolent_fund.html

I also have this file set to load from our online offering basket web
page at
http://www.actsministrieschristianevangelism.org/financial/online_offering_basket.html
 as a pop up window by clicking a submit button.

What I really want to have happen is for the CLOSE WINDOW button to
appear when this is loaded as a pop up window from our
online_offering_basket.html file and if the web page is loaded directly
then the link to our Online Offering Basket appear for the user to get
back into our web site.  


Do you know how to do this?

Ron


a href=javascript:window.close()Close/a

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



[PHP-DB] Re: RSS/XML

2005-12-18 Thread El Bekko

Henry Ortega wrote:

I want to put a website's RSS feed on my website.
For example,
http://beccary.com/feed/

I want to put all the titles of that blog page on my website.
Is there an easy way to do this?



I wrote a tutorial on RSS creation in PHP:

http://icstrategy.midgetforhire.com/RSS/Tutorial/RSS%20Tutorial.html

Have fun with it :)

El Bekko

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



[PHP-DB] Re: RSS/XML

2005-12-16 Thread El Bekko

Henry Ortega wrote:

I want to put a website's RSS feed on my website.
For example,
http://beccary.com/feed/

I want to put all the titles of that blog page on my website.
Is there an easy way to do this?


Because they're all in a DB, yes, very easy :)

Just build your RSS feed through PHP.

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



[PHP-DB] Re: Character encoding issues: Pound- sign £ becomes a ú - why?

2005-12-14 Thread El Bekko

Alex Gemmell wrote:

Hello,

I'm experiencing some odd character encoding issues.  My PHP webpage is 
displaying test from a MySQL database.  What happens is that I export 
data from an SQL Server database to a MySQL (4.0) database.  Somewhere 
along the line the British currency pound-sign £ becomes a ú (u with 
somesort of accent on it!).  I cannot figure out why this is happening 
and what to do about it.


I could use a PHP routine to find-and-replace the chars but surely there 
 is a way to tackle the root problem?


Any ideas gang?

Alex


Try using the pound; charachter.

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



[PHP-DB] Re: Date Formatting Question

2005-12-14 Thread El Bekko

Bomgardner, Mark A wrote:

I am trying to format the month portion of a date that I am trying to
pull from MySQL to be placed into a drop down menu to modify the date.
I have tried several ways and none seem to be working.  

I am pulling the date out of MySQL with: 
$sDate = explode(-, $row_events['Sdate']);


And then attempting to insert each portion of the array into a drop down
menu with:
echo select name=Smonth;
echo option selected$sDate[1]/option;
which is where I am running into the problem.  I pull out the month as 2
digit numeric 01, 02, 03 etc., but I want it displayed as January,
February, March, etc.,

I have tried the following with no success:
Date(F,strtotime($sDate));  
Strftime(%B:,$sDate);

Date(F,$sDate);


I would use MySQL to format the date, but I have three date fields to
modify and it would be easier to do it in PHP

Any pointers would be appreciated.


Mark Bomgardner
Technology Specialist
KLETC


make a function like this:

function datenum2str($date)
{
$newdate = str_replace(01,Jan,$date);
$newdate = str_replace(02,Feb,$date);
$newdate = str_replace(03,Mar,$date);
$newdate = str_replace(04,Apr,$date);
$newdate = str_replace(05,May,$date);
$newdate = str_replace(06,Jun,$date);
$newdate = str_replace(07,Jul,$date);
$newdate = str_replace(08,Aug,$date);
$newdate = str_replace(09,Sep,$date);
$newdate = str_replace(10,Oct,$date);
$newdate = str_replace(11,Nov,$date);
$newdate = str_replace(12,Dec,$date);

return $newdate;
}

And then use this:

echo select name=Smonth;
echo option selected value=\$sDate[1]\$newdate/option;


Hope it helps,

El Bekko

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



[PHP-DB] Re: formatting a date from mysql

2005-12-12 Thread El Bekko

Eternity Records Webmaster wrote:

I need to figure out how to format the date format: year-month-day
(2005-12-06). It is a date(8) field in a mysql table that i pulled out of
the table with php 5.0.5. I need it in the format: Tue December 6, 2005 (or
in mysql's formatting: 6-12-2005). I am using the reformatting for display
only. So it would be something like this:

echo $journal['Date']; //with whatever formatting needed

If possible I need php to do the formatting for me. Thanks...


An easy way to do it:

?php
explode(-,$date);
$journal['Date'] = $date[2] . - . $date[1] . - . $date[0];
?

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



[PHP-DB] Re: SQL Insert INTO question

2005-12-08 Thread El Bekko

geekgirl1 wrote:

First time poster.

This is the problem.  I want to add the value of $_POST[review] to the
reviews table where the unique id from the reviews table equals the
review id on my form.  The statement below does not work.  Should I
use UPDATE instead?

INSERT INTO reviews (review_txt)
VALUES
('$_POST[review]') WHERE review_id = $id;

Marian


INSERT INTO reviews (review_txt)
VALUES
('$_POST[\'review\']') WHERE review_id = '$id';

There, now it should work :)

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



[PHP-DB] Re: ftp_put

2005-12-08 Thread El Bekko

Chris Payne wrote:

Hi there everyone,

 


I'm using FTP to upload a file from a form, the information is stored in a
MySQL DB and then FTP'd to the server.  Is it possible - without altering
the php.ini file as I don't have access to this on my clients server - to be
able to upload large files rather than small ones?  I know with POST there
are limits, but we're talking about megabytes rather than KB's needing to be
uploaded.  They HAVE to be uploaded via some kind of form as it sends the
data to a database such as the file name and location so that it can easily
be found by the system otherwise I'd just tell them to use normal FTP
software.

 


What's the best way of achieving this?  I'm talking file 5-20megs in size.

 


Thanks everyone.

 


Chris


Max size defined in PHP.ini is 2MB, and I don't think you can change 
that without having access to the file...


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



[PHP-DB] Re: SELECT html table

2005-12-05 Thread El Bekko

Ron Piggott (PHP) wrote:

I would like to display the contents of my table with the first row
being grey in background and the next row being white and the third row
being grey, fourth being white, etc.  I am not sure how to do this.


Well, that's pretty easy to do actually :P
You have your while() statement to execute your displaying part. In 
there, you add some if()'s


I'll use an example for 20 posts. An example:

$array1 = array(1,3,5,7,9,11,13,15,17,19)

?php
while($i  $totalrows)
{
$j = $i - 1;
if($i == array1[$j])
{
--some code--
echo tb class=\grey\all the rest/tb;
}
else
{
--some code--
echo tb class=\white\all the rest/tb;
}
--more code--
}
?

This is a really easy way to do it, and I guess it works :)

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



[PHP-DB] Re: problem of transmitting variable from page to another page.

2005-12-03 Thread El Bekko

Mohamed Yusuf wrote:

 I am transmitting variable from one of my pages and I would like to match
that variable into mysql data. it won't return data.
my code is this.

?php for ($j=A; $j = Z; $j++) {
   echo | ba href='alpha.php?artist=$j'$j/a/b |;
   if ($j == Z) {
   break;
  }
 } ?
this code in my index page prints alphabetical letters from A-Z. and I woul
like to transmit that variable into my alpha.php page and select mysql
database what ever the value of $j is, but i have problem I can't figured
out what is wrong. can somebody help me.


Try

?php
for ($j=A; $j = Z; $j++)
{
   echo | ba href=\alpha.php?artist=$j\$j/a/b |;
if ($j == Z)
{
break;
}
}
?

I'm using a similar thing, except my data comes from a database and then 
refers to a page. And it works fine (check 
http://icstrategy.midgetforhire.com/Strategies.php). If this doesn't 
work, it's odd :P


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



[PHP-DB] Re: IS_NUMERIC ?

2005-11-29 Thread El Bekko

http://php.belnet.be/manual/en/function.is-numeric.php

Apparently there is :)


Dwight Altman wrote:

Hello List,
Is there an IS_NUMERIC(aCandidateString) function in MySQL that I can run in
a query, similar to the various PHP is_* functions?  I can't seem to find
it in the docs (other than a C API IS_NUM macro).

I have a field in a database with serial numbers like:
...1234
...1235
...1236-A
...1237B
and I want to get the last 4 characters of the numeric substring like so:
1234
1235
1236
1237

I should be able to do it in 1 SQL query if there is an IS_NUMERIC
equivalent, or else I will probably write a PHP script.

Regards,
Dwight


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