<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>

<channel>
	<title>byDust ( New media, Design and Web developer : Nick Van der Vreken )</title>
	<atom:link href="http://www.bydust.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bydust.com</link>
	<description>Nick Van der Vrekens blog &#38; portfolio</description>
	<pubDate>Mon, 27 Sep 2010 10:46:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Warning 5843: updates postphoned</title>
		<link>http://www.bydust.com/warning-5843-updates-postphoned/</link>
		<comments>http://www.bydust.com/warning-5843-updates-postphoned/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 15:58:00 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
		
		<category><![CDATA[Announcements]]></category>

		<guid isPermaLink="false">http://www.bydust.com/?p=452</guid>
		<description><![CDATA[A quick note to let you know I will be updating the portfolio section of this website soon. I don&#8217;t know if anyone really cares about the portfolio section but here&#8217;s a note anyway.
I will not be releasing a new version of Fhi-zin and the AJAX class due to a severe time shortage, sorry to [...]]]></description>
			<content:encoded><![CDATA[<p>A quick note to let you know I will be updating the portfolio section of this website soon. I don&#8217;t know if anyone really cares about the portfolio section but here&#8217;s a note anyway.</p>
<p>I will not be releasing a new version of Fhi-zin and the AJAX class due to a severe time shortage, sorry to keep you waiting ;-)</p>
<p>bbye</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bydust.com/warning-5843-updates-postphoned/feed/</wfw:commentRss>
		</item>
		<item>
		<title></title>
		<link>http://www.bydust.com/443/</link>
		<comments>http://www.bydust.com/443/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 07:12:33 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
		
		<category><![CDATA[Diary]]></category>

		<guid isPermaLink="false">http://www.bydust.com/443/</guid>
		<description><![CDATA[Hmm, it has been a while since I&#8217;ve written in this diary here&#8230;
We&#8217;re currently on a long weekend thanks to the easter holidays, friday and monday aren&#8217;t workdays either. I&#8217;m not taking the two weeks holiday right now, will try to take them at the end of my time here and do some sightseeing in [...]]]></description>
			<content:encoded><![CDATA[<p>Hmm, it has been a while since I&#8217;ve written in this diary here&#8230;</p>
<p>We&#8217;re currently on a long weekend thanks to the easter holidays, friday and monday aren&#8217;t workdays either. I&#8217;m not taking the two weeks holiday right now, will try to take them at the end of my time here and do some sightseeing in this nice country.</p>
<p>I&#8217;ve spent the whole day in rehab friday, talking to people and just having fun. I remember watching a movie, think it was Saving Private Ryan. My memory is failing these days, must be the nice weather :)<br />
Saturday we went back to rehab in the evening, just dropping in to see how things were going. Jeffrey ran off - again - and this time he&#8217;s not allowed to come back in. Too bad, but its understandable seeing he&#8217;d stay for a couple of days and run off again&#8230;</p>
<p>Yesterdaymorning (=sunday) we took some of the rehab people to church with us, and surprise surprise - it was boring as always. Too much talk about Jesus and his magic tricks, maybe I should try another church to see if there&#8217;s a difference. In the afternoon we had a beach trip sceduled, took some of the rehab guys with again. Can&#8217;t remember exactly which beach we went to - Camps Bay or Bayside or something - but the view is great. Small bays, Table mountain in sight and blue water with nice waves. Housing goes from 1.2mil rand and up, pretty cheap compared to our Belgian appartments with view on a straight line of blue/gray see. ( R1 200 000 ~= €100 000 )</p>
<p>After the beach visit we dropped the guys off at rehab and hung out there for a while, and took Sarah with us for a braai in the evening. Apparently people don&#8217;t trust me with her, Dewald was warning me not to go anywhere and Karlien &#8220;invited&#8221; us to her place to keep an eye on us. xD<br />
Anyway, the braai was great :)<br />
Sarah kicked my ass twice in the fingerboard game, lucky Shane wone a game and defended the family honor.</p>
<p>Digging further into the past&#8230; Wednesday we had a houseparty to celebrate Dewalds birthday  - the poor bastard is already 35 years old. Party was okay, a lot of people I don&#8217;t know but thats a solvable problem. I met Jaco, he&#8217;s a 24 year old laywer student. Had a nice chat about South Africas political parties, past, current and future economic state and stuff like that. He doesn&#8217;t see a very bright future for this country if it continues the way its heading now, and I suppose he could know.<br />
Had a lot of fun with Karlien, Natasha &amp; Shane at the party, and met Anton&#8217;s daughter. She&#8217;s a 15 year old college student, studying tourism ( I was surprised too, apparently thats possible in this country ). She seemed pretty bored and after an hour of watching her playing games on her cellphone I decided to make her evening more interesting. Well, I hope it was more interesting anyway :) Saw her again in church, forgot to mention that a few paragraphs above.</p>
<p>Okay, lets see what else I did after the last note in this diary&#8230; I remember going to rehab a few times, but don&#8217;t know what I did so no point writing about it. I&#8217;ll let you know once I remember.</p>
<p>Oh, and I&#8217;m going to Cape Point with Adrian tomorrow, he&#8217;s a travel agent based in Durbanville. Will talk to him about a website in return for some free/cheaper trips around the country in june. I&#8217;ll let you know more after the trip ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bydust.com/443/feed/</wfw:commentRss>
		</item>
		<item>
		<title></title>
		<link>http://www.bydust.com/440/</link>
		<comments>http://www.bydust.com/440/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 11:13:15 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
		
		<category><![CDATA[Diary]]></category>

		<guid isPermaLink="false">http://www.bydust.com/?p=440</guid>
		<description><![CDATA[This morning we had a meeting with all office staff and site managers, Gavi gave a presentation about how to give good instructions, things to watch out for and common misunderstandings. We talked about the different kind of persons too, and how to respond to them.
At the end of the presentation we played a little [...]]]></description>
			<content:encoded><![CDATA[<p>This morning we had a meeting with all office staff and site managers, Gavi gave a presentation about how to give good instructions, things to watch out for and common misunderstandings. We talked about the different kind of persons too, and how to respond to them.</p>
<p>At the end of the presentation we played a little game, to see which team remembered the most of it. We won ( ofcourse :) ) with Shane and myself being the two persons who remembered most. I brought the final victory home for our team after the last timed quiz.  ( and I must say we were very lucky that Didier did worse than I did :D )</p>
<p>Yesterday Terrence went back to rehab, but he didn&#8217;t have time to pick me up. Well, that or he wanted to go out with the girls all by himself. Still dont&#8217; know :)<br />
Was a bit sad, I really wanted to go.  Haven&#8217;t seen Sarah since sunday and I like talking to her, but I guess I&#8217;ll have to wait till sunday.</p>
<p>Other than that there&#8217;s not much to say really, I can&#8217;t go out with this damn leg. Its getting better however :)<br />
So how was your week ?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bydust.com/440/feed/</wfw:commentRss>
		</item>
		<item>
		<title></title>
		<link>http://www.bydust.com/436/</link>
		<comments>http://www.bydust.com/436/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 10:08:03 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
		
		<category><![CDATA[Diary]]></category>

		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.bydust.com/?p=436</guid>
		<description><![CDATA[This weekend was pretty quiet, I stayed at home at saturdays and went to rehab and church yesterday. I wanted to write a small diary note on fridays, but somehow the internet got fukt at the office :( The only thing working was mail through SMTP, which I don&#8217;t use :(
Oh, and I went to [...]]]></description>
			<content:encoded><![CDATA[<p>This weekend was pretty quiet, I stayed at home at saturdays and went to rehab and church yesterday. I wanted to write a small diary note on fridays, but somehow the internet got fukt at the office :( The only thing working was mail through SMTP, which I don&#8217;t use :(<br />
Oh, and I went to rehab last thursday too. It seems weird, but I like being there&#8230;</p>
<p><span id="more-436"></span></p>
<p>Since I can&#8217;t remember in detail what happend a few days ago I&#8217;ll just tell you about yesterday. We drove to rehab to pick up a few people to go to church with us.<br />
Jeffrey ( he came back :) ), Nico and two new guys were willing to go. After the service I talked to Jeffrey, who couldn&#8217;t seem to understand my vision on religion and church. He made me repeat it 5 (five!) times xD. Don&#8217;t think he understands it fully yet, and probably never will. I must be crazy in his eyes :D</p>
<p>I talked to Nico too, he&#8217;s an incredible smart guy. Definately not the kind of person you&#8217;d expect to see in rehab. I started talking to him last thursday, mostly about South Africas politics, economy and history. Yesterday I asked him some questions about South Africas policy for foreigners, working in South Africa, influence of the crisis on South Africas economy etc&#8230;<br />
Nico has a university degree in *something* and worked in several big companies before, manager-type positions. Before he went to rehab he was a tour-guide for tourists, and hearing him tell about several things I suppose he&#8217;s a very good one too.</p>
<p>In the evening we went back to rehab, this time to take the girls to church. We took Sarah, Avril &amp; Valentina, and they were dressed like *WAAUW* :D<br />
Had a lot of fun with Sarah, talked a lot and laughed even more. Apparently I have nice eyes, she wants to have them. I still don&#8217;t know if thats good or not&#8230;<br />
Anyway, while talking to her I heard a few things about her past that really shocked me. I wouldn&#8217;t think these things would happen in real life if I didn&#8217;t hear her talking about it. Next time someone tells me they have a crappy history and bad youth I can tell them her story. Or at least part of it, its not exactly something you tell everyone&#8230;</p>
<p>On a more positive note, the guy who gave his shocking testimony and ran off a few nights ago came back to the rehab, he used heroine a few times and is trying to quit again.</p>
<p>Heather ran off too thursday or fridaynight and came back yesterday, she&#8217;s in solitary lockup for two weeks. I kinda feel sorry for her, but its for the best.</p>
<p>Well, gotta get to work now. Bertie&#8217;s cleaning up the conference room, so I suppose the weekly meeting will start in a few minutes. Cheers !</p>
<p>// I just heard one of our employees got shot this weekend. He&#8217;s in the hospital. :(</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bydust.com/436/feed/</wfw:commentRss>
		</item>
		<item>
		<title>motorcycle accident</title>
		<link>http://www.bydust.com/motorcycle-accident/</link>
		<comments>http://www.bydust.com/motorcycle-accident/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 12:23:12 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
		
		<category><![CDATA[Diary]]></category>

		<guid isPermaLink="false">http://www.bydust.com/?p=434</guid>
		<description><![CDATA[I just got back from the hospital, we had a little accident with the motorcycle. I&#8217;m pretty much ok, only have a few bruises and my knee is fukt. The private hospitals in South Africa seem to do a nice job, I got out in two hours :)
I was sitting at the back of the [...]]]></description>
			<content:encoded><![CDATA[<p>I just got back from the hospital, we had a little accident with the motorcycle. I&#8217;m pretty much ok, only have a few bruises and my knee is fukt. The private hospitals in South Africa seem to do a nice job, I got out in two hours :)</p>
<p>I was sitting at the back of the motorcycle while Dewald was driving, we were on our way to buy a computer cable thingy.  A car stopped in the middle of the road without signalling to turn or anything, so Dewald passed it at full speed. When we were right after the car the driver decided to turn in, so we crashed into the side. Don&#8217;t really have an idea what happend after, I hope I did a nice salto before landing on the pavement. :)<br />
Anyway, we both landed on the pavement, next to the broken motorcycle. I stood up immediately, looking if Dewald was ok. Was heavily bleeding from my nose, hand and knee but didn&#8217;t seem to notice it at the time.</p>
<p>Bystanders helped us, giving me a tissue and some sugerwater because I was shaking a bit. I found my shoe under the motorcycle, which was leaking gasoline. I doubt if it survived the crash, there were pieces of plastic and metal all over the place. Guess Dewald will have to come to work on foot xD.<br />
Ambulances were there pretty quickly, we were lucky to crash a few blocks from the hospital I suppose. Medics checked me out, saying my knee shows burnwounds and it doesn&#8217;t look too good. They seemed surprised I could walk. :)</p>
<p>Dewald has hurt his arm pretty bad, not broken luckily. Sitting in the office, just had lunch. I got hungry in the hospital :)</p>
<p>Well, that was pretty much my day untill now. Lets hope the rest is better ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bydust.com/motorcycle-accident/feed/</wfw:commentRss>
		</item>
		<item>
		<title></title>
		<link>http://www.bydust.com/430/</link>
		<comments>http://www.bydust.com/430/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 07:26:16 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
		
		<category><![CDATA[Diary]]></category>

		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://www.bydust.com/?p=430</guid>
		<description><![CDATA[Yesterday evening I went back to the rehab house for a couple of hours, just to chat to the people there. Talked to Jeffrey, Sara, Rosalyn &#38; her brother ( I keep forgetting that guys name. Its something like &#8220;Andrew&#8221; :D ).
While I was talking to Sara I noticed she changed a lot since the [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday evening I went back to the rehab house for a couple of hours, just to chat to the people there. Talked to Jeffrey, Sara, Rosalyn &amp; her brother ( I keep forgetting that guys name. Its something like &#8220;Andrew&#8221; :D ).</p>
<p>While I was talking to Sara I noticed she changed a lot since the last time I saw her,  she thought about what I said and probably came to the conclusion that I was right. She was very optimistic, knowing that the situation she&#8217;s in now isn&#8217;t the best place to be but its necessairy to get out of the life she&#8217;s living. She was also thinking about going back to school or try homeschooling, another thing I tried to convince her of last time. There was no more black make-up and she didn&#8217;t try to hide herself from everything and everyone, so I&#8217;m pretty sure I got through to her. I even get hugs :)</p>
<p><span id="more-430"></span></p>
<p>I suppose she&#8217;s listening to me because I seem to be the only one who is talking to her without mentioning God every few sentences, and I try to listen to her problems and needs without talking about mine. Anyway, I&#8217;m glad I got through to her and maybe changed her life for the better.</p>
<p>Jeffrey seemed to be in a better mood to, he told me about the part of his life when he started believing in God and how he tried to commit suicide. Although I still don&#8217;t believe the way they do, I&#8217;m glad to hear their stories. I believe that in the end - no matter what we believe in -  we&#8217;re trying to get to that same situation in life, a better life for us and for the people standing next to us.</p>
<p>Talked to Rosalyn too, she was having mood swings and was trying to learn Dutch from me. Its strange to see how she was very enthousiastic sometimes, and the next moment everything bores her and she just walks around the house. I believe that she can be a wonderfull woman, a strong personality and that she&#8217;s capable of leading the group when she passed this stage in her life. I hope she&#8217;ll think about an abortion, although I know how hard it is for a woman to make that decision, even if she knows that its for the best. Maybe I&#8217;ll talk to her about it next time - don&#8217;t know.</p>
<p>Well, I better get to work now. bye ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bydust.com/430/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Church &amp; Rehab in South Africa</title>
		<link>http://www.bydust.com/church-rehab-in-south-africa/</link>
		<comments>http://www.bydust.com/church-rehab-in-south-africa/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 07:22:57 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
		
		<category><![CDATA[Diary]]></category>

		<guid isPermaLink="false">http://www.bydust.com/?p=424</guid>
		<description><![CDATA[Rehab
Yesterdayevening I went to a rehab home here in Cape Town, thats a home where people can kick off of drugs or alcohol addictions. Its very different than the homes we know at home, mostly by the fact that the person who runs it is in fact the mother of a drug addict. She doesn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<h2>Rehab</h2>
<p>Yesterdayevening I went to a rehab home here in Cape Town, thats a home where people can kick off of drugs or alcohol addictions. Its very different than the homes we know at home, mostly by the fact that the person who runs it is in fact the mother of a drug addict. She doesn&#8217;t get any funds for what she&#8217;s doing, but somehow manages to pay the rent and buy the medicines.</p>
<p>The people I&#8217;m staying with visit the rehab sometimes, bringing distraction to those who live there. We bought some drinks for the evening and played guitar ( well, Terrence did. I can&#8217;t play :( ). Its a good way to learn about society, because on these places you&#8217;ll hear and see things you never would otherwise.</p>
<p><span id="more-424"></span></p>
<p>I talked to several people, one of them was an ex-drug addict and criminal. He gave his testimony to the whole group, and I must say it was really shocking to hear his life story. He witnessed the murder of a 7year old girl, shot through the head with three pistols because she was a prostitute. I&#8217;m not going to write everything here but now you know the kind of things I heard&#8230;<br />
When I went back this morning I heard he ran off early, I&#8217;m guessing he couldn&#8217;t deal with the stress and pain you get from kicking off. I hope he&#8217;s coming back, but fear that he&#8217;s falling back into his old life.</p>
<p>Another person worth mentioning is Sarah, she&#8217;s a 14year old girl kicking off from a heroine addiction. I talked quite a lot to her, yesterday evening and this morning. She already tried to commit suicide a few times, her arms wear the marks of fresh cuts and scars from previous attempts. She ran away from home a few years ago, and lived on the street before she went to rehab. Bad friends, worse boyfriend. They need to cuff her to the bed at night to make sure she doesn&#8217;t commit suicide again or runs off to her past. According to Terrence I created a band with her, she doesn&#8217;t seem to talk to a lot of people here. I&#8217;m hoping I got through to her, maybe changed her life for the better.</p>
<p>Jeffrey&#8217;s staying there too, he&#8217;s a real Cape Town skateboarder. Lives in his own dreamworld, but its a really nice guy if you start talking to him. He&#8217;s kicking off from a few addictions, I think he tried everything and got stuck with a lot of it. I&#8217;ve been talking to him for an hour or two yesterday evening, and had a quick chat this morning ( he made me coffee :) ).</p>
<p>Rosalyn&#8217;s a - beautifull - 20*something* year old woman, staying at the rehab center along with her brother. She kicked off from her addiction and is now pregnant from her brother. For those of you who don&#8217;t know, increased sexual activity is one of the symptoms from kicking off from a drug addiction. As you can see it&#8217;s pretty hard to get through this period, most people don&#8217;t function normally.</p>
<h2>Church</h2>
<p>This morning we went back to the rehab house, to see who was interested in going to church. You should know that church and religion here in South Africa is very different than what we know at home. People really believe that God has a path for them and mention God and Jesus in every other sentence. God is really in their lives, and guides them wereever they go. I can&#8217;t explain it, you&#8217;ll have to see it yourself.</p>
<p>Anyway, we picked up Rosalyn, her brother and the guy that helped me repair the TV ( yes, I repaired the TV at the rehab home yesterday. They were very thankfull ;-) ) to go to church with us. It&#8217;s strange to see how such young troubled people have such an interest in God. At the church I could see how the people here really &#8220;experience&#8221; god, they don&#8217;t just believe he exists. During the service a guy collapsed while singing a few rows in front of me. At first I thought it was just another nutcase, but near the end of the service I saw how people really believe and give themselves to a higher power. I&#8217;m not a great believer myself, so to convice me that its real you have to try very hard ;-)</p>
<p>As I said, I&#8217;m not a believer. I believe in God but thats about it, I don&#8217;t like all the Jesus stories and I honestly think the bible is only usefull if there&#8217;s no toilet paper left. It&#8217;s a great experience for me to witness a church service like that, although I think they talk too much but only some of them come through with actions.</p>
<p>At the end of the service ( a service takes two hours ) you can come forward to get blessed. I wasn&#8217;t exactly in a hurry to get at the front, but my friends were. Even the troubled drug addicts, which may seem odd to you.<br />
I saw how people gave themselves to God while being blessed by the priest. After the blessing they feel a peace, as if God has decended and entered their body. Some of them even fainted and fell flat backwards on the ground, they were covered with a blanket untill they woke up a few minutes after. It was hard for me to believe what I saw, I sat on the front row and saw it happen a few meters before me. After witnessing the blessing I no longer believe that these people are just making stuff up, they really believe in something and for them it&#8217;s there, in the chruch and in the daily life. I&#8217;m still not a believer myself, but I do believe that there is a higher power for them. If you really really believe in something or someone its there for you, but its a personal choice.</p>
<p>I spoke to several people afterwards, priests, believers, sceptists and converts, and I enjoyed hearing their stories and how they are living their lives, how they live with religion and spirituality. Maybe my presence here has a purpose as they say, I don&#8217;t know. What I do know is that I&#8217;ll probably never believe like they do, but I&#8217;ll learn a lot from their stories and experiences.</p>
<p>Enough about that. I went to the fitness too ( and i feel it, ffs ), went to Dewalds mother to eat lunch, visited Tiger Valley Mall and bought a book to learn Spanish. We didn&#8217;t have power here for the better part of the day, so I think I&#8217;ll really use the book ;-)<br />
I was thinking of buying a 3G internet box, but it seems too expensive for three months. Atm I only have internet at the office, so don&#8217;t expect me to reply to mails quickly or pop up on MSN.</p>
<p>Ok, will do something else now. Cheers !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bydust.com/church-rehab-in-south-africa/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Wasteplan pictures</title>
		<link>http://www.bydust.com/413/</link>
		<comments>http://www.bydust.com/413/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 13:45:20 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
		
		<category><![CDATA[Diary]]></category>

		<guid isPermaLink="false">http://www.bydust.com/?p=413</guid>
		<description><![CDATA[Some pictures from work
These were taken with my camera, hence the bad quality :( Most of the time they are doing something, this was just lunch time ;-)






]]></description>
			<content:encoded><![CDATA[<h2>Some pictures from work</h2>
<p>These were taken with my camera, hence the bad quality :( Most of the time they are doing something, this was just lunch time ;-)</p>
<p><div id="attachment_412" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0216.jpg"><img class="size-thumbnail wp-image-412" title="cam_0216" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0216-150x150.jpg" alt="Frazzitta Business Park" width="150" height="150" /></a><p class="wp-caption-text">Frazzitta Business Park</p></div></p>
<p><div id="attachment_411" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0215.jpg"><img class="size-thumbnail wp-image-411" title="cam_0215" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0215-150x150.jpg" alt="Frazzitta Business Park" width="150" height="150" /></a><p class="wp-caption-text">Frazzitta Business Park</p></div></p>
<p><div id="attachment_410" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0214.jpg"><img class="size-thumbnail wp-image-410" title="cam_0214" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0214-150x150.jpg" alt="Frazzitta Business Park" width="150" height="150" /></a><p class="wp-caption-text">Frazzitta Business Park</p></div><br />
<span id="more-413"></span><br />
<br style="clear:both"/></p>
<p><div id="attachment_409" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0213.jpg"><img class="size-thumbnail wp-image-409" title="cam_0213" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0213-150x150.jpg" alt="Frazzitta Business Park" width="150" height="150" /></a><p class="wp-caption-text">Frazzitta Business Park, Wasteplan office ( 1st floor )</p></div></p>
<p><div id="attachment_408" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0212.jpg"><img class="size-thumbnail wp-image-408" title="cam_0212" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0212-150x150.jpg" alt="Frazzitta Business Park, entrance" width="150" height="150" /></a><p class="wp-caption-text">Frazzitta Business Park, entrance</p></div></p>
<p><div id="attachment_407" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0211.jpg"><img class="size-thumbnail wp-image-407" title="cam_0211" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0211-150x150.jpg" alt="Frazzitta Business Park" width="150" height="150" /></a><p class="wp-caption-text">Frazzitta Business Park</p></div><br />
<br style="clear:both"/><br />
<div id="attachment_406" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0210.jpg"><img class="size-thumbnail wp-image-406" title="cam_0210" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0210-150x150.jpg" alt="Frazzitta Business Park" width="150" height="150" /></a><p class="wp-caption-text">Frazzitta Business Park</p></div></p>
<p><div id="attachment_405" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0209.jpg"><img class="size-thumbnail wp-image-405" title="cam_0209" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0209-150x150.jpg" alt="Frazzitta Business Park, view from Wasteplan office" width="150" height="150" /></a><p class="wp-caption-text">Frazzitta Business Park, view from Wasteplan office</p></div></p>
<p><div id="attachment_404" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0208.jpg"><img class="size-thumbnail wp-image-404" title="cam_0208" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0208-150x150.jpg" alt="Frazzitta Business Park, Wasteplan office entrance" width="150" height="150" /></a><p class="wp-caption-text">Frazzitta Business Park, Wasteplan office entrance</p></div><br />
<br style="clear:both"/><br />
<div id="attachment_403" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0207.jpg"><img class="size-thumbnail wp-image-403" title="cam_0207" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0207-150x150.jpg" alt="Frazzitta Business Park, view from Wasteplan entrance" width="150" height="150" /></a><p class="wp-caption-text">Frazzitta Business Park, view from Wasteplan entrance</p></div></p>
<p><div id="attachment_402" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0206.jpg"><img class="size-thumbnail wp-image-402" title="cam_0206" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0206-150x150.jpg" alt="Frazzitta Business Park" width="150" height="150" /></a><p class="wp-caption-text">Frazzitta Business Park</p></div></p>
<p><div id="attachment_401" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0205.jpg"><img class="size-thumbnail wp-image-401" title="cam_0205" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0205-150x150.jpg" alt="Frazzitta Business Park, office" width="150" height="150" /></a><p class="wp-caption-text">The Wasteplan office</p></div><br />
<br style="clear:both"/><br />
<div id="attachment_400" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0204.jpg"><img class="size-thumbnail wp-image-400" title="cam_0204" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0204-150x150.jpg" alt="Dewald &amp; Shane, eating my bread ( I ate theirs yesterday )" width="150" height="150" /></a><p class="wp-caption-text">Dewald &amp; Shane, eating my bread ( I ate theirs yesterday )</p></div></p>
<p><div id="attachment_399" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0203.jpg"><img class="size-thumbnail wp-image-399" title="cam_0203" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0203-150x150.jpg" alt="Frazzitta Business Park, view from the Wasteplan office" width="150" height="150" /></a><p class="wp-caption-text">Frazzitta Business Park, view from the Wasteplan office</p></div></p>
<p><div id="attachment_398" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0202.jpg"><img class="size-thumbnail wp-image-398" title="cam_0202" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0202-150x150.jpg" alt="Jaco, working extremely hard ( sorry :) )" width="150" height="150" /></a><p class="wp-caption-text">Jaco, working extremely hard ( sorry :) )</p></div><br />
<br style="clear:both"/><br />
<div id="attachment_397" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox[post]" href="http://www.bydust.com/wp-content/uploads/2009/03/cam_0201.jpg"><img class="size-thumbnail wp-image-397" title="cam_0201" src="http://www.bydust.com/wp-content/uploads/2009/03/cam_0201-150x150.jpg" alt="Dewald, working even harder" width="150" height="150" /></a><p class="wp-caption-text">Dewald, working even harder</p></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bydust.com/413/feed/</wfw:commentRss>
		</item>
		<item>
		<title></title>
		<link>http://www.bydust.com/391/</link>
		<comments>http://www.bydust.com/391/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 10:32:08 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
		
		<category><![CDATA[Diary]]></category>

		<guid isPermaLink="false">http://www.bydust.com/?p=391</guid>
		<description><![CDATA[Day three in Cape Town, already had a few problems here. Among others the lack of decent internet, but that seems to be solved now :)
When I arrived here I had a small problem at the Customs office, I couldn&#8217;t show them a return ticket. I suppose in any other country that wouldn&#8217;t be a [...]]]></description>
			<content:encoded><![CDATA[<p>Day three in Cape Town, already had a few problems here. Among others the lack of decent internet, but that seems to be solved now :)</p>
<p>When I arrived here I had a small problem at the Customs office, I couldn&#8217;t show them a return ticket. I suppose in any other country that wouldn&#8217;t be a big problem, but South Africa&#8217;s policy for foreigners is pretty strict. Took me 45minutes to get through, and convice them that I wasn&#8217;t going to stay longer than three months&#8230; To make things worse, they managed to lose my luggage during the flight.<br />
So I stood in Cape Town with nothing but my laptop and the clothes I was wearing. I didn&#8217;t really care, knowing everything would be ok one way or the other I just went to see robben island and Waterfront with a few of my roommates. Already made some friends here :D</p>
<p>Yesterday I got a call from the Airport personnel, saying they found my luggage and will bring it to me asap. It got delivered to my lodge an hour later, and nothing was missing. *joy* </p>
<p>So, today ( =day three ) I moved out of the lodge because it was too far away from work. The only way to get here would be an hour on the ( safe/not-so-safe? ) train and taking a cab to get to the company premises. Will miss the friends I have there, but I&#8217;ll make new ones here. I&#8217;m now staying in a ( really nice ) villa, together with two other company employees. I won&#8217;t go out as much as I would when I stayed at the lodge, but I&#8217;ll see the real South African life and thats why I came here. </p>
<p>Cape Town itself seems very nice, people are friendly and helpfull. There&#8217;s a lot of poverty here, and people are doing everything to earn money. There are people that watch your car if you park somewhere, people selling magazines and newspapers at the street corner, people selling hats at the crossroads and so on. I suppose thats the African life :)</p>
<p>Cabs are really cheap here, we&#8217;ve paid 18 rand each to get from the Lodge to Waterfront. Its approximately a 15minute drive, for 1,5 euros ( just so you understand ). I&#8217;m using the minivan cabs, they pick up several people and drop them off where ever they need to be. Its the cheapest kind of taxi here, and not dangerous. The driver will try to rip you off tho, so beware ;-)</p>
<p>I went to the mall to, they have some really good clothing shops. Instead of going to Ghent or Antwerp to shop, you guys should come here ;-)<br />
It&#8217;s a lot cheaper too, so if you buy enough stuff you&#8217;ll get your flight ticket price back.</p>
<p>Cheers !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bydust.com/391/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Advanced PHP Query function</title>
		<link>http://www.bydust.com/advanced-php-query-function/</link>
		<comments>http://www.bydust.com/advanced-php-query-function/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 13:42:36 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.bydust.com/?p=379</guid>
		<description><![CDATA[Today&#8217;s web applications are becoming more and more advanced, and most of them are relying on data stored in databases. In most cases several queries have to be executed to get the initial data in the application, so a quick way to get this job done would be usefull. Thats why I&#8217;ve made this advanced [...]]]></description>
			<content:encoded><![CDATA[<p>Today&#8217;s web applications are becoming more and more advanced, and most of them are relying on data stored in databases. In most cases several queries have to be executed to get the initial data in the application, so a quick way to get this job done would be usefull. Thats why I&#8217;ve made this advanced PHP query function to use in my own projects, but I&#8217;m sure many of you will find it usefull too.</p>
<p>Some of its features are custom SQL parameters like LAST_INSERTED_ID or INSERT_ID_FROM(n), executing different queries in one line of code, quickly returning SELECT queries as arrays, returning the new ID as the query result for INSERT-statements and so on.<br />
<span id="more-379"></span></p>
<h2>Executing several SQL-statements easily</h2>
<p>Suppose we need several SELECT-queries to retrieve the data needed for our application to run. Many of you already have made query-functions to retrieve the database resultset in just one line of code, but this probably still creates a new connection for each query you execute. Instead of doing that, we can loop through an array of SQL-statements and execute them all in the same connection. You&#8217;ll get the same result, but only one connection to the database is created, which results in a better function performance.</p>
<p>Offcourse we still need to be able to fetch all result-sets returned by our queries. This is where the &#8220;$query_results&#8221;-array comes in handy. I&#8217;ve placed a small example below to clear things up.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// when executing multiple queries, the function will always</span>
<span style="color: #666666; font-style: italic;">// return the result from the last executed SQL-statement</span>
<span style="color: #666666; font-style: italic;">// you can execute one query by just passing the </span>
<span style="color: #666666; font-style: italic;">// SQL-statement as a string, or execute multiple by passing</span>
<span style="color: #666666; font-style: italic;">// an array of SQL-statements.</span>
<span style="color: #000088;">$sessions</span> <span style="color: #339933;">=</span> query<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;SELECT * FROM db_accounts&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;SELECT * FROM db_hits_np&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;SELECT * FROM db_sessions_np&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// we can get the other results through $query_results</span>
<span style="color: #666666; font-style: italic;">// pass the index of the SQL-statement to get its result</span>
<span style="color: #666666; font-style: italic;">// be carefull, the indexes start from 0 !		</span>
<span style="color: #000088;">$accounts</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$query_results</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$hits_np</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$query_results</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h2>Getting the result as an associative array</h2>
<p>This is basically the same functionality as the mysql_fetch_array() method, but it saves you a line of code. You can specify a second (optional ) parameter when calling the function to specify if you want the result of the query to be returned as a normal resultset or as an associative array.<br/><br />
Set this optional parameter to &#8220;true&#8221; if you&#8217;d like an associative array to be returned, false otherwise. The default value is false.</p>
<h2>SQL INSERT-statement functions</h2>
<p>There are many situations where we need to insert a new record to the database, and right after use the newly inserted ID in our code. We can retrieve the new ID through the SQL &#8220;@@IDENTITY&#8221; command or PHP&#8217;s mysql_insert_id() function, but wouldn&#8217;t it be a nice feature to get the ID as a result of every INSERT-statement ?  This function does it all for you.</p>
<h3>Custom SQL syntax for easier coding with INSERT-statements</h3>
<p>It happens quite a lot when we insert several new records in a database, and we need the newly added ID in other SQL statements. Instead of using our query result in our next SQL-statement, we can add a bunch of statements and define in our SQL which ID should come instead of the given parameter. There are 2 custom SQL variables available:</p>
<p>LAST_INSERTED_ID</p>
<p>This parameter returns the last inserted ID, as you could probably guess. Here&#8217;s an example:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// we're using the LAST_INSERTED_ID here to </span>
<span style="color: #666666; font-style: italic;">// use the newly returned ID of the last</span>
<span style="color: #666666; font-style: italic;">// INSERT-statement in this connection. </span>
<span style="color: #666666; font-style: italic;">// Don't use this if the last query was not </span>
<span style="color: #666666; font-style: italic;">// an INSERT-statement</span>
query<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;INSERT INTO db_first_table(name, value, something) VALUES('name', 'value', 'something')&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;INSERT INTO db_second_table(first_id, value) VALUES(LAST_INSERTED_ID, 'value')&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>INSERT_ID_FROM(number)</p>
<p>Less obvious to use is the INSERT_ID_FROM variable. Before executing your query, this variable is replaced by the ID returned from one of the previous SQL INSERT-statements executed in the same database connection. We can define the SQL-statements index in the parameter. Another example:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// we're using the INSERT_ID_FROM here to</span>
<span style="color: #666666; font-style: italic;">// the newly added ID of one of the previous</span>
<span style="color: #666666; font-style: italic;">// INSERT-statements of this connection.</span>
<span style="color: #666666; font-style: italic;">// pass the index of the INSERT-statement</span>
<span style="color: #666666; font-style: italic;">// to the parameter</span>
query<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;INSERT INTO db_first_table(name, value, something) VALUES('name', 'value', 'something')&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;INSERT INTO db_second_table(first_id, value) VALUES(LAST_INSERTED_ID, 'value')&quot;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">&quot;INSERT INTO db_third_table(first_id, value) VALUES(INSERT_ID_FROM(0), 'value')&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h2>The Query-function</h2>
<p>So here it is, the function I&#8217;ve spent 902 words on in this post:<br />
( You can easily download the function in the zip-file attached below )</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$c_host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$c_database</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'database_name'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$c_username</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'username'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$c_password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'password'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">,</span> <span style="color: #000088;">$arr</span><span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Advanced PHP Query function by Nick Van der Vreken</span>
	<span style="color: #666666; font-style: italic;">// more information about this function on</span>
	<span style="color: #666666; font-style: italic;">// http://www.bydust.com/advanced-php-query-functionadvanced-php-query-function/</span>
	<span style="color: #666666; font-style: italic;">// please leave this comment intact if you're using my function :-)</span>
&nbsp;
	<span style="color: #990000;">global</span> <span style="color: #000088;">$c_host</span><span style="color: #339933;">,</span> <span style="color: #000088;">$c_database</span><span style="color: #339933;">,</span> <span style="color: #000088;">$c_username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$c_password</span><span style="color: #339933;">,</span> <span style="color: #000088;">$query_inserted_id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$query_results</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$query_inserted_id</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$query_results</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$queries</span> <span style="color: #339933;">=</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$sql</span><span style="color: #339933;">:</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$conn</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$c_host</span><span style="color: #339933;">,</span> <span style="color: #000088;">$c_username</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$c_password</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$c_password</span><span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">NULL</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$c_database</span><span style="color: #339933;">,</span> <span style="color: #000088;">$conn</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$queries</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">eregi</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'LAST_INSERTED_ID'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// LAST_INSERTED_ID parameter</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query_inserted_id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> 
				<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'LAST_INSERTED_ID'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$query_inserted_id</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query_inserted_id</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$query</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">else</span> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Error on LAST_INSERTED_ID, there were no insert-statements executed in the current connection'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">eregi</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'INSERT_ID_FROM'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// INSERT_ID_FROM parameter</span>
			<span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'INSERT_ID_FROM('</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$n</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #000088;">$s</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$n</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query_inserted_id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$query_inserted_id</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$n</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Error on INSERT_ID_FROM, wrong index'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$s</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$id</span> <span style="color: #339933;">.</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">')'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #666666; font-style: italic;">//echo &quot;&lt;br/&gt;&lt;b&gt;Query $i: &lt;/b&gt; $query&quot;;</span>
		<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span>  <span style="color: #000088;">$query</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$conn</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #990000;">array_push</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$query_results</span><span style="color: #339933;">,</span> <span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
		<span style="color: #990000;">array_push</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$query_inserted_id</span><span style="color: #339933;">,</span> <span style="color: #990000;">mysql_insert_id</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$conn</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">==</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$queries</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'INSERT'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">||</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'insert'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$query_inserted_id</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query_inserted_id</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #990000;">mysql_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$conn</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$result</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">mysql_fetch_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">NULL</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Don&#8217;t forget to set the database information in the variables mentioned, otherwise this won&#8217;t work !</p>
<p>If you have any fixes or additions, feel free to share with us ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bydust.com/advanced-php-query-function/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
