Jump to content

Raven1313

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Raven1313's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I think I managed to figure it out. In the database original and the one I am inserting into should have character set to UTF8 and collation UTF8_unicode_ci.
  2. This is the insert into query: $sql=mysql_query("select PLAST,PREF,POPEN,PCLOSE,PBID,PVOL,PVALUE,PASK,NATIVE_TICKER from hist_sec where DATE(PDATE) = DATE(NOW()) "); $num=mysql_num_rows($sql); for($i = 0;$i < $num;$i++) { $arr1 = mysql_fetch_row($sql); $PLAST=$arr1[0]; $PREF=$arr1[1]; $POPEN=$arr1[2]; $PCLOSE=$arr1[3]; $PBID=$arr1[4]; $PVOL=$arr1[5]; $PVALUE=$arr1[6]; $PASK=$arr1[7]; $TICKER=$arr1[8]; $change1=($PLAST-$PREF)*100/$PREF; $change1=number_format($change1, 2, '.', ','); if($PLAST!="") { $mysql_query = mysql_query("INSERT INTO `mydatabase`.`loser_gainer` (`change` ,`Stock` ,`Last` ,`Vol`)VALUES ('$change1', '$TICKER', '$PLAST', '$PVOL')"); So basically I pull from hist_sec table and INSERT INTO loser_gainer table but when I check loser_gainer table I check the column STOCK and it contains "??????" characters instead of Arabic characters.
  3. I'm pulling Arabic Characters from a table and then inserting them into a different table but there it shows as ??????? instead of Arabic characters. Is there an INSERT INTO syntax that works for characters that are not English?
  4. Thank you Barand! Now it's working
  5. What should I change VARCHAR to?
  6. Hello Barand, Below is the result you request: CREATE TABLE `hist_sec` ( `PDATE` date NOT NULL, `STKNO` double NOT NULL, `ROWNO` double NOT NULL, `TICKER` varchar(25) NOT NULL, `NATIVE_TICKER` varchar(25) NOT NULL, `PREF` varchar(15) NOT NULL, `PLAST` varchar(15) NOT NULL, `POPEN` varchar(15) NOT NULL, `PHIGH` varchar(15) NOT NULL, `PLOW` varchar(15) NOT NULL, `PVOL` varchar(15) NOT NULL, `PVALUE` varchar(15) NOT NULL, `PTRADES` varchar(15) NOT NULL, `PCLOSE` varchar(15) NOT NULL, `PBID` varchar(15) NOT NULL, `PASK` varchar(15) NOT NULL, `CHANGE` varchar(15) NOT NULL, `VWAP` varchar(15) NOT NULL, `YHIGH` varchar(15) NOT NULL, `YLOW` varchar(15) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8
  7. I'm trying to select PVOL (a number) by desc to get the top 5 values of that column. But I don't get the top 5 values of PVOL... I just get the highest which is LESS than 1,000,000 all the numbers above 1mil don't show up. select PLAST,PREF,POPEN,PCLOSE,PBID,PVOL,PVALUE,PASK,TICKER from hist_sec where DATE(PDATE) = DATE(NOW()) and PVOL != '' order by PVOL DESC limit 0 , 5; How do I select where I also include the numbers above 1 mil?
  8. Thank you Gristoi and Daniel! It works
  9. Hello Everyone, I'm new to PHP and I'm trying to output some data using PHP and MYSQL. When I use my MYSQL Query Browser and I type this: select PREF from hist_index where DATE(PDATE) = DATE(NOW()) AND STKNO = 11; I get the data I need, which is the Price Index of today. But when I echo this out; I get: Resource id #4 I have a project which outputs 10 variable that are available on hist_index table (8 of them under the row where STKNO=11, and the other two are when STKNO=10). I can query the data but I can't seem to find a way to echo them. I read that making an array is the way to go. Instead of "select"ing them one by one, I can select them all and assign them to an array then out put the array. Do I HAVE to use arrays to out put them? Thank in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.