Jump to content

Search the Community

Showing results for tags 'array while php mysql'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello all, I have a problem with a while bucle and an array, here is the code: I have 2 querys, the result of query 1 is stored into an array and the second query is handled with while. The problem is the $bib variable have always NULL as value, but it's wrong, ... $sql="select distinct(biblionumber) from biblioitems where biblionumber in(select biblionumber from issn_master where issn1 in($lista)or issn2 in($lista) or issnL in ($lista))"; $qry = mysql_query($sql); $sql1="select embargo,fondo,tipo_fondo from stage1 where grupo='".$grupo."' and issn in(select issn1 from issn_master where issn1 in($lista)) or issn in(select issn2 from issn_master where issn2 in($lista));"; $qry1 = mysql_query($sql1); $data = array(); while ($row = mysql_fetch_assoc($qry)) { $data[] = $row[biblionumber]."\n"; } $bib=implode("\n",$row[biblionumber]); while($row1 = mysql_fetch_assoc($qry1)) { $inc++; $sql_item= "insert into items (biblionumber,biblioitemnumber,itype,enumchron,booksellerid,itemcallnumber,barcode,homebranch,holdingbranch,notforloan,damaged,itemlost,wthdrawn,timestamp)values('".$bib."','".$bib."','".$row1[tipo]."','".$row1[fondo]."','".$row1[embargo]."','".$grupo."-".$inc.$row1['type']."-".$bib."','".$grupo."-".$inc.$row1['type']."-".$bib."','".$grupo."','".$grupo."',0,0,0,0,'".$date."')"; echo $sql_item; } If you execute this: foreach($data as $bib){ echo $bib; } Then the result is: 21758 68314 I don't see what is wrong in my code. The correct result expected is: insert into items (biblionumber,biblioitemnumber,itype,enumchron,booksellerid,itemcallnumber,barcode,homebranch,holdingbranch,notforloan,damaged,itemlost,wthdrawn,timestamp)values(21758'',21758'',21758'','1996-','','MHUPA-1-21758','MHUPA-1-21758','MHUPA','MHUPA',0,0,0,0,'')insert into items (biblionumber,biblioitemnumber,itype,enumchron,booksellerid,itemcallnumber,barcode,homebranch,holdingbranch,notforloan,damaged,itemlost,wthdrawn,timestamp)values(68314'',68314'','68314','2001-','','MHUPA-2-68314','MHUPA-2-68314','MHUPA','MHUPA',0,0,0,0,'') Some on can help? Thanks a lot 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.